Req #24214 [Opn->Ana]: debug_backtrace() fails to report __FILE__, __LINE__

From: Date: Tue, 24 Oct 2017 01:52:21 +0000
Subject: Req #24214 [Opn->Ana]: debug_backtrace() fails to report __FILE__, __LINE__
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211874@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=24214&edit=1

 ID:                 24214
 Updated by:         kalle@php.net
 Reported by:        gk at proliberty dot com
 Summary:            debug_backtrace() fails to report __FILE__, __LINE__
-Status:             Open
+Status:             Analyzed
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   Irrelevant
 PHP Version:        4.3.2
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2014-04-28 14:34:59] levim@php.net

This is still present in 5.5 and in the 5.6 betas.

------------------------------------------------------------------------
[2003-06-23 17:35:48] sniper@php.net

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&currency_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) {


------------------------------------------------------------------------
[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'?

------------------------------------------------------------------------


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

    https://bugs.php.net/bug.php?id=24214


--
Edit this bug report at https://bugs.php.net/bug.php?id=24214&edit=1


Thread (12 messages)

« previous php.bugs (#211874) next »