|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #39070 debug_backtrace output when call_user_func or error handler involved
Submitted: 2006-10-06 20:16 UTC Modified: 2007-08-17 16:15 UTC
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (50.0%)
From: alan dot harder at sun dot com Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.2.0 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: alan dot harder at sun dot com
New email:
PHP Version: OS:


 [2006-10-06 20:16 UTC] alan dot harder at sun dot com
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:

Perhaps this should be a ChangeLog entry on the docs page for debug_backtrace.

Reproduce code:
function my_func() { 1 / 0; }
function do_backtrace() { print_r(debug_backtrace()); }

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-17 16:15 UTC]
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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 27 14:03:37 2021 UTC