Hi, I just migrated a site to a new server.
after migration, when click on nodes I get: The website encountered an unexpected error. Please try again later.

On Drupal's log messages I can see the following error:

ParseError: syntax error, unexpected '<', expecting end of file en views_plugin_argument_default_php->get_argument() (línea 1 de /srv/www/eme/ps/archivo/sites/default/modules/views/plugins/views_plugin_argument_default_php.inc(53) : eval()'d code).

in the old server everything works fine without errors.

I think it could be related to PHP differences between the servers, but not sure.

old server is 5.5.23-pl0-gentoo
new server is 7.0.8-0ubuntu0.16.04.3

then, based on the log error, I tried to comment the first line of views_plugin_argument_default_php.inc to see what it happens and the node displayed with all the content but printing this at the top:

/* ''); return $options; } function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['code'] = array( '#type' => 'textarea', '#title' => t('PHP contextual filter code'), '#default_value' => $this->options['code'], '#description' => t('Enter PHP code that returns a value to use for this filter. Do not use <?php ?>. You must return only a single value for just this filter. Some variables are available: the view object will be "$view". The argument handler will be "$argument", for example you may change the title used for substitutions for this argument by setting "argument->validated_title"".'), ); // Only do this if using one simple standard form gadget $this->check_access($form, 'code'); } function convert_options(&$options) { if (!isset($options['code']) && isset($this->argument->options['default_argument_php'])) { $options['code'] = $this->argument->options['default_argument_php']; } } /** * Only let users with PHP block visibility permissions set/modify this * default plugin. */ function access() { return user_access('use PHP for settings'); } function get_argument() { // set up variables to make it easier to reference during the argument. $view = &$this->view; $argument = &$this->argument; ob_start(); $result = eval($this->options['code']); ob_end_clean(); return $result; } } 

any ideas of what is going on? thanks!

Comments

gusans created an issue. See original summary.

Lendude’s picture

Status: Active » Postponed (maintainer needs more info)

Error is in eval()'d code

Looks like the View has some PHP code to generate a default value for an argument, and the PHP added in that argument setting fails, not any code in the Views module.

So check if the contextual filter settings contain any custom PHP snippets.

Is that the case?

gusans’s picture

just checked the views but they aren't using any contextual filter or custom php snippet. Is it possible to check this in a global way instead of entering one by one?

all the views are pretty simple blocks/pages with list of fields.

if it helps, the only "particular" view I have is one block using Gmap module for display some nodes on a map, but the block shows fine on landing page.

Lendude’s picture

Is it possible to check this in a global way instead of entering one by one?

Sorry, can't really think of a way.

You could try to comment out this line in views_plugin_argument_default_php->get_argument():
$result = eval($this->options['code']);

That seems to be the spot where it goes wrong.

And if your page then loads maybe you can find what is missing or showing to much on your page and backtrace it that way.( Or if you have xdebug available just put a breakpoint there and see which view is executing).

gusans’s picture

Hi @Lendude , finnaly I could solve the problem.

after your suggestion I tried to deactivate php core module -to see what happens- and found the errors were gone. then the node displayed all the field except one geolocation field that shows a location on a google map.
the problem was on geolocation and a missing google api key. I don't know why on the old server was working...

thank you very much!

gusans’s picture

Status: Postponed (maintainer needs more info) » Fixed
Lendude’s picture

@gusans no problem, happy you got it running and thanks for reporting back!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.