#30541 [NEW]: $php_errormsg isn't set when an error occured in a function called by eval()

From: Date: Sat, 23 Oct 2004 14:49:22 +0000
Subject: #30541 [NEW]: $php_errormsg isn't set when an error occured in a function called by eval()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68007@lists.php.net to get a copy of this message
From: php at dush dot student dot utwente dot nl Operating system: linux 2.6 PHP version: 5.0.2 PHP Bug Type: Unknown/Other Function Bug description: $php_errormsg isn't set when an error occured in a function called by eval() Description: ------------ in debug mode, my script stores every error that occured in the script. when an error occurs in eval(), the error is stored correctly in $php_errormsg. however when the error occured in a function called by eval() the error isn't stored anymore. Reproduce code: --------------- register_tick_function("store_errors", true); function &store_errors($do_tick = true) { GLOBAL $php_errormsg; static $errors = array(); if ($do_tick) { if (isset($php_errormsg) && $php_errormsg != "") { if ($trace = debug_backtrace()) { $func = $trace[1]['function']; if (isset($trace[1]['class'])) $func = $trace[1]['class'].$trace[1]['type'].$func; }else { $func = 'unknown'; } $errors[] = array( 0 => $php_errormsg, 1 => $func ); $php_errormsg = ""; } }else { return $errors; } } /* stupid test function */ function blah() { echo $blah2; echo "error is set here: $php_errormsg<br>"; } eval ('echo $blah1; blah();'); $ar = store_errors(false); while(list($key,$val) = each($ar)) { echo "{$key} => {$val[0]} in {$val[1]}<br>\n"; } Expected result: ---------------- Notice: Undefined variable: blah1 in /home/dush/public_html/core/loader.inc.php(28) : eval()'d code on line 1 Notice: Undefined variable: blah2 in /home/dush/public_html/core/loader.inc.php on line 27 error is set here: Undefined variable: blah2 0 => Undefined variable: blah1 in unknown 1 => Undefined variable: blah2 in blah Actual result: -------------- Notice: Undefined variable: blah1 in /home/dush/public_html/core/loader.inc.php(28) : eval()'d code on line 1 Notice: Undefined variable: blah2 in /home/dush/public_html/core/loader.inc.php on line 27 error is set here: Undefined variable: blah2 0 => Undefined variable: blah1 in unknown -- Edit bug report at http://bugs.php.net/?id=30541&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30541&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30541&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30541&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30541&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30541&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30541&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30541&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30541&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30541&r=support Expected behavior: http://bugs.php.net/fix.php?id=30541&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30541&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30541&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30541&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30541&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30541&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30541&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30541&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30541&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30541&r=mysqlcfg

« previous php.bugs (#68007) next »