#38047 [NEW]: "file" and "line" sometimes not set in backtrace from inside error handler

From: Date: Sun, 09 Jul 2006 13:11:01 +0000
Subject: #38047 [NEW]: "file" and "line" sometimes not set in backtrace from inside error handler
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99249@lists.php.net to get a copy of this message
From: thuejk at gmail dot com Operating system: Linux PHP version: 5.1.4 PHP Bug Type: Unknown/Other Function Bug description: "file" and "line" sometimes not set in backtrace from inside error handler Description: ------------ I generate a backtrace from inside my error handler. Among other things I use the file and line numbers in the error handler. In one case, inconsistent with behaviour for other types of errors, file and line are not set in the frame for the error handler transition in the backtrace. I think (without bothering to check) that this error was introduced after I upgraded from 5.0.4 to 5.1.4 Reproduce code: --------------- <?php error_reporting(E_ALL); set_error_handler('kalus_error_handler'); ini_set("display_errors", "on"); class A { function A_ftk() { } } function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) { get_error_context(); } function get_error_context() { $backtrace = debug_backtrace(); echo $backtrace[1]["line"]; echo "<pre>";print_r($backtrace); } //If this is uncommented, the resulting code will have file and line set for the call into the error handler. #$a = $aa; //This will not create file and line items for the call into the error handler $page["name"] = A::A_ftk(); ?> Expected result: ---------------- $backtrace[1]["file"] and $backtrace[1]["line"] should be set. Actual result: -------------- Notice: Undefined index: line in /home/tjk/kalus3_clean/trunk/src/web/include/setup.php on line 17 Array ( [0] => Array ( [file] => /home/tjk/kalus3_clean/trunk/src/web/include/setup.php [line] => 12 [function] => get_error_context [args] => Array ( ) ) [1] => Array ( [function] => kalus_error_handler [args] => Array ( [0] => 2048 [1] => Non-static method A::A_ftk() should not be called statically [2] => /home/tjk/kalus3_clean/trunk/src/web/include/setup.php [3] => 25 [4] => Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( ) [_COOKIE] => Array ( [__utma] => 192968248.1592420362.1149610271.1149805566.1149849975.6 [__utmz] => 192968248.1149620260.3.2.utmccn=(referral)|utmcsr=mail.google.com|utmcct=/mail/|utmcmd=referral [PHPSESSID] => o194fe6r7m7fvgm4do1dspqnk0 ) [_FILES] => Array ( ) ) ) ) [2] => Array ( [file] => /home/tjk/kalus3_clean/trunk/src/web/include/setup.php [line] => 25 [function] => A_ftk [class] => A [type] => :: [args] => Array ( ) ) ) -- Edit bug report at http://bugs.php.net/?id=38047&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38047&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38047&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38047&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38047&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38047&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38047&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38047&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38047&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38047&r=support Expected behavior: http://bugs.php.net/fix.php?id=38047&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38047&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38047&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38047&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38047&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38047&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38047&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38047&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38047&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38047&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38047&r=mysqlcfg

« previous php.bugs (#99249) next »