note 38938 added to function.debug-backtrace

From: Date: Mon, 12 Jan 2004 22:45:29 +0000
Subject: note 38938 added to function.debug-backtrace
Groups: php.notes 
Request: Send a blank email to php-notes+get-63371@lists.php.net to get a copy of this message
Not sure if this is expected behaviour but the "args" portion of the returned array is not present if you call your function as an argument to another function. i.e. <?php function test($in){ return($in); } function test2($in){ print_r(debug_backtrace()); return($in); } test(test2(6)); ?> As you can see, the args array doesn't show up in the output of debug_backtrace (PHP 4.3.4). I noticed this when trying to debug a function I was using to set a constant i.e. <?php define("MY_CONSTANT", myFunc(1, 2, 3, 4)); ?> Which I guess is fairly normal thing to do... The workaround is to assign the return value of your function to a temp variable and use this variable in the second function call i.e. <?php $tmp = myFunc(1, 2, 3, 4); define("MY_CONSTANT", $tmp); ?> ---- Manual Page -- http://www.php.net/manual/en/function.debug-backtrace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38938 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38938&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38938&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63371) next »