ID: 24214
Updated by: sniper@php.net
Reported By: gk at proliberty dot com
Status: Open
Bug Type: Feature/Change Request
Operating System: linux ; kernel 2.4.18
PHP Version: 4.3.2
New Comment:
Here's quickie patchie which doesn't drop the debug_backtrace() call
itself out of the result array.
We could add an optional parameter to debug_backtrace()
which makes it include itself in the result too. Leaving
open for discussion, I don't need this myself, but if
enough people think it's useful.... :)
Hint:
https://www.paypal.com/xclick/business=sniper@php.net&no_note=1&tax=0¤cy_code=EUR
diff -u -r1.124.2.9 zend_builtin_functions.c
--- Zend/zend_builtin_functions.c 16 Jun 2003 15:55:07 -0000
1.124.2.9
+++ Zend/zend_builtin_functions.c 23 Jun 2003 22:32:13 -0000
@@ -1210,11 +1210,6 @@
ptr = EG(current_execute_data);
- /* skip debug_backtrace() */
- ptr = ptr->prev_execute_data;
- cur_arg_pos -= 2;
- frames_on_stack--;
-
array_init(return_value);
while (ptr) {
Previous Comments:
------------------------------------------------------------------------
[2003-06-19 17:43:15] gk at proliberty dot com
I just realized that the expected result I entered is not consistent
with how debug_backtrace() works: function debug_backtrace must also be
listed. Here's a revision.
Expected result:
----------------
[greg@p3 xobj]$ php /tmp/a.php
Array(
[0] => Array
(
[file] => /tmp/a.php
[line] => 1
[function] => debug_backtrace
[args] => Array
(
)
)
)
------------------------------------------------------------------------
[2003-06-18 15:17:42] philip@php.net
fwiw, I also feel this is a valid (and worthy) feature request and
assumed debug_backtrace() behaved as such.
------------------------------------------------------------------------
[2003-06-18 15:12:23] gk at proliberty dot com
Your solution is not elegant: adding extra parameters when
debug_backtrace() would be enough if it behaved consistently in all
cases.
This is also a documentation bug. Please do not set to 'bogus'. How can
a feature request be 'bogus'?
------------------------------------------------------------------------
[2003-06-18 14:38:01] sniper@php.net
Just pass the __FILE__ and __LINE__ to your phpc_trigger_error()
function, problem solved.
e.g.
phpc_trigger_error( $errorMessage,$errorCode,__FILE__, __LINE__,
debug_backtrace() );
------------------------------------------------------------------------
[2003-06-17 14:32:55] gk at proliberty dot com
I forgot to point out why the phpc_trigger_error() example is not an
adequate workaround for the lack of consistency in debug_backtrace().
Although I use __LINE__ and __FILE__ when $debug_backtrace[0] is not
set, these values are pretty useless since they are set from the
context of the phpc_trigger_error function, NOT from the place where it
was called from; where the error occured. If debug_backtrace() always
returned __LINE__ and __FILE__ we would have everything we need.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/24214--
Edit this bug report at http://bugs.php.net/?id=24214&edit=1