1--TEST-- 2Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler) 3--FILE-- 4<?php 5error_reporting(E_ALL); 6set_error_handler('kalus_error_handler'); 7ini_set("display_errors", "on"); 8 9class A { 10 function A_ftk($a) { 11 } 12} 13 14function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) { 15 echo "$error_string\n"; 16 get_error_context(); 17} 18 19function get_error_context() { 20 $backtrace = debug_backtrace(); 21 $n = 1; 22 foreach ($backtrace as $call) { 23 echo $n++." "; 24 if (isset($call["file"])) { 25 echo $call["file"]; 26 if (isset($call["line"])) { 27 echo ":".$call["line"]; 28 } 29 } 30 if (isset($call["function"])) { 31 echo " ".$call["function"]."()"; 32 } 33 echo "\n"; 34 } 35 echo "\n"; 36} 37 38//This will not create file and line items for the call into the error handler 39$page["name"] = A::A_ftk(); 40?> 41--EXPECTF-- 42Non-static method A::A_ftk() should not be called statically 431 %sbug38047.php:13 get_error_context() 442 %sbug38047.php:36 kalus_error_handler() 453 %sbug38047.php:36 A_ftk() 46 47Missing argument 1 for A::A_ftk(), called in %sbug38047.php on line 36 and defined 481 %sbug38047.php:13 get_error_context() 492 %sbug38047.php:7 kalus_error_handler() 503 %sbug38047.php:36 A_ftk() 51