Exceptions thown in a function/method been called via 'call_user_func' or 'call_user_func_array', have key 'file' and 'line' disappeared in their first element (array[0]) from Exception::getTrace().
getTrace());
}
function callback() {
call_user_func('test');
}
try {
callback();
} catch (Exception $e) {
var_dump($e->getTrace());
}
?>
G:\wwwroot\Test\Exception>php trace_func.php
#0 test() called at [G:\wwwroot\Test\Exception\trace_func.php:8]
array(1) {
[0]=>
array(4) {
["file"]=>
string(40) "G:\wwwroot\Test\Exception\trace_func.php"
["line"]=>
int(8)
["function"]=>
string(4) "test"
["args"]=>
array(0) {
}
}
}
#0 test()
#1 call_user_func(test) called at [G:\wwwroot\Test\Exception\trace_func.php:14]
#2 callback() called at [G:\wwwroot\Test\Exception\trace_func.php:18]
array(3) {
[0]=>
array(2) {
["function"]=>
string(4) "test"
["args"]=>
array(0) {
}
}
[1]=>
array(4) {
["file"]=>
string(40) "G:\wwwroot\Test\Exception\trace_func.php"
["line"]=>
int(14)
["function"]=>
string(14) "call_user_func"
["args"]=>
array(1) {
[0]=>
string(4) "test"
}
}
[2]=>
array(4) {
["file"]=>
string(40) "G:\wwwroot\Test\Exception\trace_func.php"
["line"]=>
int(18)
["function"]=>
string(8) "callback"
["args"]=>
array(0) {
}
}
}
Similar result given by debug_print_backtrace(), is this a bug or an unexpected feature ? XD