From: thuejk at gmail dot com
Operating system: All
PHP version: 5.2.5
PHP Bug Type: Scripting Engine problem
Bug description: "file" and "line" missing in debug_backtrace() output
Description:
------------
In all cases (but the one below one), "file" and "line" indexes are
defined in each frame of the output of debug_backtrace.
But when using call_user_function() or call_user_function_array, "file"
and "line" is not defined for one of the frames.
It would be nice if I could count on file and line always being defined
when using the output of debug_backtrace, thereby avoiding code for special
cases.
For the missing file and line in the example code below, when calling f()
inside call_user_function(), I suggest using the file and line of the
call_user_function() call.
See also bug 38047 and 24405.
Reproduce code:
---------------
<?php
error_reporting(E_ALL | E_STRICT);
function f() {
$a = $b;
var_dump(debug_backtrace());
}
//The backtrace generated here will not have file and line defined
call_user_func("f", Array());
//The backtrace generated here will have file and line defined.
f();
?>
Expected result:
----------------
The frame with index 0 of the first debug_backtrace_call should contain
indexes "file" => "test.php" and "line" => 6
Actual result:
--------------
array(2) {
[0]=>
array(2) {
["function"]=>
string(1) "f"
["args"]=>
array(1) {
[0]=>
&array(0) {
}
}
}
[1]=>
array(4) {
["file"]=>
string(18) "/home/tjk/test.php"
["line"]=>
int(6)
["function"]=>
string(14) "call_user_func"
["args"]=>
array(2) {
[0]=>
&string(1) "f"
[1]=>
&array(0) {
}
}
}
}
array(1) {
[0]=>
array(4) {
["file"]=>
string(18) "/home/tjk/test.php"
["line"]=>
int(8)
["function"]=>
string(1) "f"
["args"]=>
array(0) {
}
}
}
--
Edit bug report at http://bugs.php.net/?id=44428&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44428&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44428&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44428&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44428&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44428&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44428&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44428&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44428&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44428&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44428&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44428&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44428&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44428&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44428&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44428&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44428&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44428&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44428&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44428&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44428&r=mysqlcfg