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

From: Date: Tue, 17 Jun 2003 16:40:35 +0000
Subject: #24214 [Opn->Fbk]: debug_backtrace() fails to report __FILE__, __LINE__
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42143@lists.php.net to get a copy of this message
 ID:               24214
 Updated by:       sniper@php.net
 Reported By:      gk at proliberty dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: linux ; kernel 2.4.18
 PHP Version:      4.3.2
 New Comment:

Can you show an example where this could somehow be useful?
(you can always use __FILE__ and __LINE__ :)



Previous Comments:
------------------------------------------------------------------------

[2003-06-16 19:33:06] gk at proliberty dot com

Description:
------------
debug_backtrace() should behave consistently in order to be useful in
all contexts: inside classes, functions and from top level of script
file.

However, when exectuted from top level, it returns an empty array.

According to the documentation, it should return an array with minimal
info including __LINE__, __FILE__
>debug_backtrace() generates a PHP backtrace and returns this
information as an associative array. The possible returned elements are
listed in the following table: 
...
line integer The current line number. See also __LINE__.  
file string The current file name. See also __FILE__.  



Reproduce code:
---------------
<?php print_r(debug_backtrace()); ?>

Expected result:
----------------
[greg@p3 xobj]$ php /tmp/a.php
array(1) {
    [0]=>
    array(4) {
        ["file"] => string(10) "/tmp/a.php"
        ["line"] => int(1)
        ["function"] =>
        ["args"]=>
    }
}



Actual result:
--------------
[greg@p3 xobj]$ php /tmp/a.php
Array
(
)



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


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



Thread (12 messages)

« previous php.bugs (#42143) next »