note 110237 added to function.debug-backtrace
| From: | d at rren dot me | Date: | Thu, 04 Oct 2012 07:35:37 +0000 |
| Subject: | note 110237 added to function.debug-backtrace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191123@lists.php.net to get a copy of this message | ||
Howdy guys, just a note really - The ['args'] data within the resulting array is supplied
by reference. I found myself editing the reference unknowingly which in turn shows its ugly head
further down the line if you call multiple backtrace.
<?php
$trace = array_reverse(debug_backtrace());
// LOOP BACKTRACE
$la = 0;
$lb = count($trace);
while ($la<$lb){
// DATA FROM BACKTRACE
$trace[$la]['file'];
$trace[$la]['line'];
$trace[$la]['args'];
$trace[$la]['function'];
// DATA FROM BACKTRACE
// LOOP ARGUMENTS ARRAY
$ba = 0;
$bb = count($trace[$la]['args']);
while ($ba<$bb){
$trace[$la]['args'][$ba] = "EDITING A REFERENCE/POINTER";
$ba++;
}
unset($bb);
unset($ba);
// LOOP ARGUMENTS ARRAY
$la++;
}
unset($lb);
unset($la);
// LOOP BACKTRACE
----
Server IP: 87.124.126.49
Probable Submitter: 82.33.84.11
----
Manual Page -- http://www.php.net/manual/en/function.debug-backtrace.php
Edit -- https://master.php.net/note/edit/110237
Del: integrated -- https://master.php.net/note/delete/110237/integrated
Del: useless -- https://master.php.net/note/delete/110237/useless
Del: bad code -- https://master.php.net/note/delete/110237/bad+code
Del: spam -- https://master.php.net/note/delete/110237/spam
Del: non-english -- https://master.php.net/note/delete/110237/non-english
Del: in docs -- https://master.php.net/note/delete/110237/in+docs
Del: other reasons-- https://master.php.net/note/delete/110237
Reject -- https://master.php.net/note/reject/110237
Search -- https://master.php.net/manage/user-notes.php