|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-22 13:27 UTC] johannes@php.net
-Status: Open
+Status: Bogus
-Package: Feature/Change Request
+Package: *General Issues
[2010-12-22 13:27 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 23:00:02 2025 UTC |
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, ), ), )