#39070 [NEW]: debug_backtrace output when call_user_func or error handler involved
| From: | alan dot harder at sun dot com | Date: | Fri, 06 Oct 2006 20:16:51 +0000 |
| Subject: | #39070 [NEW]: debug_backtrace output when call_user_func or error handler involved | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969374163@lists.php.net to get a copy of this message | ||
From: alan dot harder at sun dot com
Operating system: *
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: debug_backtrace output when call_user_func or error handler involved
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 bug report at http://bugs.php.net/?id=39070&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39070&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39070&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39070&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39070&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39070&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39070&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39070&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39070&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39070&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39070&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39070&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39070&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39070&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39070&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39070&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39070&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39070&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39070&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39070&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39070&r=mysqlcfg