#39070 [Opn]: debug_backtrace output when call_user_func or error handler involved
| From: | vrana@php.net | Date: | Fri, 17 Aug 2007 16:15:14 +0000 |
| Subject: | #39070 [Opn]: debug_backtrace output when call_user_func or error handler involved | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116253@lists.php.net to get a copy of this message | ||
ID: 39070
Updated by: vrana@php.net
Reported By: alan dot harder at sun dot com
Status: Open
-Bug Type: Documentation problem
+Bug Type: Feature/Change Request
Operating System: *
-PHP Version: Irrelevant
+PHP Version: 5.2.0
New Comment:
Both PHP 4 and PHP 5 can be improved:
PHP 5 should fill file and line as PHP 4 do.
PHP 4 should list 'my_func' only once as PHP 5 do.
Previous Comments:
------------------------------------------------------------------------
[2006-10-06 20:16:51] alan dot harder at sun dot com
Description:
------------
I have found some inconsistencies in the behavior of debug_backtrace.
I'm not sure either of these are bugs, so I'm filing this under
documentation.
1) If call_user_func is used, debug_backtrace output includes an array
entry with no file/line info. Seems to be the case with PHP versions as
far back as 4.3.0.
debug_backtrace docs do say these are the "possible" values to be in
the backtrace, but doesn't list any conditions where file/line might be
omitted. If this behavior in the debug_backtrace output is expected,
then maybe document this here.
2) If an error handler is invoked, debug_backtrace output differs
between PHP versions. PHP 4.x has 2 entries (one with error handler and
its params, another with file/line where error occurred).. PHP 5.1.x and
5.2.0RC5 combine these into a single entry (didn't text 5.0.x). Maybe
this is related, not sure: http://bugs.php.net/bug.php?id=34175
Perhaps this should be a ChangeLog entry on the docs page for
debug_backtrace.
Reproduce code:
---------------
<pre><?php
function my_func() { 1 / 0; }
function do_backtrace() { print_r(debug_backtrace()); }
set_error_handler('do_backtrace');
call_user_func('my_func');
?></pre>
Expected result:
----------------
Output that can be predicted by reading the debug_backtrace docs.
Actual result:
--------------
file/line missing for entry after call_user_func, and array length
differs between PHP 4.x and 5.1.x/5.2.0.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39070&edit=1