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: -
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:0 of 0 (0.0%)
From: RQuadling at GMail dot com Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.3.0alpha1 OS: n/a
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 07:02:06 2014 UTC