From:             RQuadling at GMail dot com
Operating system: n/a
PHP version:      5.3.0alpha1
PHP Bug Type:     Feature/Change Request
Bug description:  Include parameter name in debug_backtrace

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
                        )

                )

        )

)

-- 
Edit bug report at http://bugs.php.net/?id=45736&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45736&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45736&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45736&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45736&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45736&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45736&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45736&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45736&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45736&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45736&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45736&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45736&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45736&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45736&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45736&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45736&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45736&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45736&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45736&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45736&r=mysqlcfg

Reply via email to