|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-27 01:30 UTC] sniper@php.net
[2006-07-27 08:22 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
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 ( ) ) )