From: [EMAIL PROTECTED] Operating system: n/a PHP version: 4.4.5 PHP Bug Type: Feature/Change Request Bug description: Enhance debug_backtrace to supply the name of parameters.
Description: ------------ Currently, debug_backtrace() supplies details of parameters to the function/method calls in the current call stack. This is extremely useful for debugging. I feel that this could be enhanced by adding the name of the parameters passed to a function/method. Currently I have to read the file associated with the function and then regexp the line to extract the parameters. This is getting more and more complicated trying to support different users coding practices. I've supplied an contrived example with the expected output for the new functionality. I initially thought that the keys of the 'args' array could be the parameters, but this would be a BC as currently they are numeric, so a new array of 'params' (Hmmm - not a great name - would need a better one), could hold the parameter text. If the parameter is a function call, then the param value would be the function call with its parameters. The main purpose is that you can show the actual parameter names the code is using in addition to the the values. Reproduce code: --------------- <?php function func($m_Param1, $m_Param2) { var_export(debug_backtrace()); return True; } $s_Foo = 'Foo'; $s_Bar = 'Bar'; func($s_Foo, $s_Bar, func($s_Foo, $s_Bar)); ?> Expected result: ---------------- array ( 0 => array ( 'file' => 'C:\\va.php', 'line' => 10, 'function' => 'func', 'args' => array ( 0 => 'Foo', 1 => 'Bar', ), 'params' => array ( 0 => '$s_Foo', 1 => '$s_Bar', ), ), )array ( 0 => array ( 'file' => 'C:\\va.php', 'line' => 10, 'function' => 'func', 'args' => array ( 0 => 'Foo', 1 => 'Bar', 2 => true, ), 'params' => array ( 0 => '$s_Foo', 1 => '$s_Bar', 2 => 'func($s_Foo, $s_Bar)', ), ), ) Actual result: -------------- array ( 0 => array ( 'file' => 'C:\\va.php', 'line' => 10, 'function' => 'func', 'args' => array ( 0 => 'Foo', 1 => 'Bar', ), ), )array ( 0 => array ( 'file' => 'C:\\va.php', 'line' => 10, 'function' => 'func', 'args' => array ( 0 => 'Foo', 1 => 'Bar', 2 => true, ), ), ) -- Edit bug report at http://bugs.php.net/?id=40918&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40918&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40918&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40918&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40918&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40918&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40918&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40918&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40918&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40918&r=support Expected behavior: http://bugs.php.net/fix.php?id=40918&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40918&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40918&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40918&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40918&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40918&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40918&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40918&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40918&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40918&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40918&r=mysqlcfg