1

After upgrading to Drupal 7, I get the following error on my recent log messages:

Notice: Undefined variable: node in eval() (line 24 of /home/scode/public_html/modules/php/php.module(74) : eval()'d code). Notice: Trying to get property of non-object in eval() (line 24 of /home/scode/public_html/modules/php/php.module(74) : eval()'d code).

The user accessing the page is "Anonymous (not verified)."

Do you have any idea?

2
  • Can you locate the faulting page, analyse if there's some PHP inserted into this node and post relevant code ? Did you also upgraded PHP from 5.2 to 5.3 ?
    – tostinni
    Commented Dec 13, 2011 at 4:33
  • If you had a debugger installed...you could just have placed a breakpoint at line 24 of php.module and had figured out very quickly what was going on. Zend Studio + Zend Debugger are your friends (if you have $3xx dollars). I've used them for years and swear by them. Others recommend Eclipse PDT + XDebug, but I don't know how to use that combo. Commented Dec 15, 2011 at 19:36

2 Answers 2

4

Something is trying to run the php_eval() function in php.module. Most likely you have something configured in your site (such as a block) to use the PHP input filter, which evaluates PHP code and prints the output as text. I would check all the blocks you have defined first.

You can also temporarily put a call to debug_print_backtrace() at the top of the php_eval() function and print it's results while browsing your site as an anonymous user to see what exactly is calling that function.

1
  • Thank you. It was a block that has a $node>path code that cause this error.
    – jaypabs
    Commented Dec 16, 2011 at 3:43
0

Or you can put if condition with eval print in php.module file.
+if(is_object('?>' . $code)){
print eval('?>' . $code);
+}

3
  • Welcome to Drupal Answers. Can you expand a little on how this addresses the original problem, especially why a patch to core is needed in this situation?
    – mpdonadio
    Commented Jan 17, 2019 at 14:14
  • It can happen one of these mistake.
    – L.Chamika
    Commented Jan 21, 2019 at 12:13
  • It can happen one of these mistake. * If you use some server memory allocate function or module * Remove module without uninstall(And called those module set variable etc.) * Uncompleted core or module updates etc. You can check it use "debug_print_backtrace()" & or backend recent log messages. Want check one by one.
    – L.Chamika
    Commented Jan 21, 2019 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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