From 71242511f93381fde9bae82e32f705a3f7dd7aff Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Thu, 12 May 2011 17:52:28 -0400 Subject: [PATCH 1/1] Print php.log stack traces in reverse order (a more standard order) --- php/plc_api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/php/plc_api.php b/php/plc_api.php index 3224601..41f65c2 100644 --- a/php/plc_api.php +++ b/php/plc_api.php @@ -61,9 +61,13 @@ class PLCAPI function backtrace_php () { $backtrace = debug_backtrace(); $msg = ""; - foreach( $backtrace as $line ) { + $len = count($backtrace); + $cnt = 1; + foreach( array_reverse($backtrace) as $line ) { $msg .= "File '". $line['file'] . "' line " . $line['line'] . "\n"; $msg .= " " . $line['function'] . "( " . $this->rec_join($line['args']) . ")\n"; + $cnt += 1; + if ( $cnt == $len ) { break; } } return $msg; } -- 2.43.0