2

I am getting the following errors from Googlebot; I am getting about 5 of them per minute, and I want to find out what is causing them.

Type php
Date Friday, February 3, 2012 - 08:16
User Anonymous (not verified)
Location http://www.*/biblio?f%5Bkeyword%5D=70&f%5Bag%5D=C&s=...
Notice: Trying to get property of non-object in eval() (line 3 of /home/sltruweb/public_html/modules/php/php.module(74) : eval()'d code).
Severity notice
Hostname 66.249.71.165

1

Notice: Trying to get property of non-object in eval() (line 3 of /home/sltruweb/public_html/modules/php/php.module(74) : eval()'d code).

If we break this down, we get:

  1. Severity: Notice. From PHP's perspective, not a big deal.
  2. Actual problem: "Trying to get property of non-object". You have something like this: $foo->bar, where $foo is not an object, and as such, ->bar does not apply
  3. line 3 of /home/sltruweb/public_html/modules/php/php.module, where the problem is happening.
  4. eval()'d code: Your actual problem.

PHP Supports something called eval(). Eval() has some, but very few legitimate uses, and in most cases should be spelled "Evil", instead. Unfortunately, it's used liberally in the Drupal world because there's a module in Core that makes it easy to use. To support my argument, "Don't use it", I quote from PHP's own documentation:

The eval() language construct is very dangerous

Now somewhere in your site, you have an eval(). And that's one of the many issues with it, based upon your error message, I can't tell you any thing more meaningful than that. To track this down better, you need to update your question with a stacktrace. This however, is not necessarily easy to produce, and you may need the help of a skilled developer.

1

The PHP module is the module implementing the PHP input filter that is used to execute PHP code to create the content of a node. The process function for that input filter is php_eval(), which is normally used from modules that needs to execute PHP code entered from a user; the Views module is one of them, and it allows the administrator user to enter PHP code in some of its settings. As the page referred from the warning error is produced by a view, if you look at the settings for that view you will find the code which is causing the error by trying to access an object property from something that is not an object. For example, if $array is an array, or a variable that has not been initialized, the following code will cause the warning you saw:

if ($array->nid) {
  echo "Node ID: {$array->nid}";
}

The -> operator can only used with objects; using it for anything that is not an object raises a warning from PHP.

1

You are getting this because you have the PHP module turned on and somewhere in your site, either in a node, block, in a views filter, someone has added php code and it is failing. This will be difficult to find because it is in the database. It is also very dangerous because since you have the PHP module turned on someone could have added something you don't want.

You could solve this problem immediately by turning off the PHP module. You can search through your database for the '<?php' tag and troubleshoot the php statements you have on your site.

EDIT: It looks like somewhere in your biblio module configuration you are using inline PHP and it isn't using is_object() or isset() for whatever parameters it is processing.

  • There are some modules that use php_eval() for executing PHP code, but they explicitly say to the user not to wrap the PHP code into <?php, and ?>; in such case, the string the user should look for doesn't contain any <?php. – kiamlaluno Feb 19 '12 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.