My error logs are filled with the following kind of log msg.

[Fri Apr 25 22:55:07 2008] [error] [client x.x.x.x] PHP Parse error: syntax error, unexpected $end in /chroot/home/domain.com/html/modules/views/views.module(539) : eval()'d code on line 1, referer: http://domain.com/cat/catpath

..for every page view.

I'm using views-5.x-1.6 and drupal 5.7.

Because views.module seems to functioning pretty well anyway, i'd been disregarding those error msgs. But I have a dark suspicion this is responsible for the elusive http Error 500s being returned to search engines, whois.sc etc. I'm pretty certain it's not the server, it happens wherever i move the site to.

Has anybody seen this error? My programmer mates swear it's a syntactical error in the code, but this is the same views.module everyone else is using and having no problems with.

If anyone has an idea about this please let me know.

K

Comments

bobblebrook’s picture

We've had pretty much the exact same problem.
The site would return a 500 internal server error to search engines, the w3c validator or digg but display to users without problems.

The line in modules/views/views.module(539) evals (that is, it takes it as a string and tries to execute that string) any argument handling PHP code in your views. You have probably created a view in which you've inserted some problematic PHP.
One thing to look out for is inserting code in conjunction with rich-text-editors: on our site, we use TinyMCE, which replaces special characters with their HTML codes (e.g. & becomes &)
We watched out for that problem from the beginning, but it might well be that a later edit of the View overwrote our PHP code with something wonky due to this.

We did the following and it resolved the problem:
Copy the PHP code from your View into a text editor, clean up the formatting and anything that might have happened to the PHP code.
Back on your site when you edit the View, turn off rich-text editing under the argument handling field, paste the code from your editor back in, overwriting anything in the field, then save the View. (don't turn the rich-text editor back on)

Not sure why it would only display errors for some visitors, but this helped us. If it doesn't, thoroughly inspect your argument handling code.

dose_of_insanity’s picture

This is GOOD feedback, thanks. I think you're on to something. The Error 500 errors have vanished - which is eerie, but we still have the errors in the logs. I'm going to follow your suggestions over the weekend - much appreciated.

Infinitee’s picture

I had the same problem and resolved it by removing the extra spaces on lines 71 & 72 in Drupal 5.10 views_node.inc like below.

Change:

      'body' => array(
        'name' => t('Node: Body'),
        'handler' => array(
          'views_handler_field_body'   => t('Full Text'),
          'views_handler_field_teaser' => t('Teaser')
        ),

To:

      'body' => array(
        'name' => t('Node: Body'),
        'handler' => array(
        'views_handler_field_body'   => t('Full Text'),
        'views_handler_field_teaser' => t('Teaser')
        ),

I hope this helps a few people,

Ralph

Infinitee Designs
http://www.infinitee-designs.com/

Summit’s picture

Subscribing, having the same errors in log.
greetings, Martijn

tabakerka’s picture

This issue could happen when someone used "<?" instead of "<?php" somewhere, but your server's php.ini disables short open tags. Check this line in your php.ini - "short_open_tag = On".

mnlznet’s picture

@tabakerka - just wanted to say thank you. Your suggestion worked for me.

ressa’s picture

Yes, run a phpinfo() in a file, and make sure that the report says "short_open_tag On", otherwise your site might break due to the use of "<?"