php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45736 Include parameter name in debug_backtrace
Submitted: 2008-08-06 15:52 UTC Modified: 2021-08-11 14:49 UTC
Votes:5
Avg. Score:3.2 ± 1.3
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: RQuadling at GMail dot com Assigned: cmb (profile)
Status: Wont fix Package: *General Issues
PHP Version: 5.3.0alpha1 OS: n/a
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: RQuadling at GMail dot com
New email:
PHP Version: OS:

 

 [2008-08-06 15:52 UTC] RQuadling at GMail dot com
Description:
------------
The debug_backtrace() provides very useful information when debugging.

Could it be possible to extend the args element within the trace so that rather than just the index of the argument being shown, show the actual text that was used?

Either as a key to the args array or as a new array which could be array_combined in userland.

Whilst the file and line values help in getting the code that made the call, if the call is over many lines ...

fn(
 var1, // comments
 var2, // comments
 var3  // comments
);

sort of thing, then the line number is the end of the call. The output below shows line 15 which is ...

);

Not a lot of use and using regex with all the potential of unmatched ) etc. is a pain.

Thanks for looking if you do.

Richard Quadling.

Reproduce code:
---------------
<?php
function fn() {
 print_r(debug_backtrace());
}

$a_Sites = array
 (
 'Web' => 'www.php.net',
 'Docs' => 'docs.php.net',
 'Wiki' => 'wiki.php.net',
 ); 

fn (
 $a_Sites
);
 

Expected result:
----------------
Array
(
    [0] => Array
        (
            [file] => C:\dbt.php
            [line] => 13
            [function] => fn
            [args] => Array
                (
                    [$a_Sites] => Array
                        (
                            [Web] => www.php.net
                            [Docs] => docs.php.net
                            [Wiki] => wiki.php.net
                        )

                )

        )

)



or 



Array
(
    [0] => Array
        (
            [file] => C:\dbt.php
            [line] => 15
            [function] => fn
            [args] => Array
                (
                    [0] => Array
                        (
                            [Web] => www.php.net
                            [Docs] => docs.php.net
                            [Wiki] => wiki.php.net
                        )

                )
            [params] => Array
                (
                    [0] => $a_Sites

                )

        )

)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [file] => C:\dbt.php
            [line] => 15
            [function] => fn
            [args] => Array
                (
                    [0] => Array
                        (
                            [Web] => www.php.net
                            [Docs] => docs.php.net
                            [Wiki] => wiki.php.net
                        )

                )

        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-11 14:49 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: cmb
 [2021-08-11 14:49 UTC] cmb@php.net
The name of the parameter is no longer available after
compilation.  Of course, that could be changed, but I don't see
the particular value (at least nowadays), thus I'm closing as
WONTFIX.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC