X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=php%2Fplc_api.php;h=41f65c212aecd81ae28f7cd1d1e1ceb3b2e63633;hb=4d5ee5be90e7033c303b0e96e78141463d1ab032;hp=f704cd438371b2ce815c4a59f89b147a34792d09;hpb=7a244becfc634d522f5c6f35aced759c001ff7f4;p=plcapi.git diff --git a/php/plc_api.php b/php/plc_api.php index f704cd4..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; } @@ -77,7 +81,7 @@ class PLCAPI $error_line='PLCAPI error: ' . $error_msg ; if ($file) $error_line .= ' in file ' . $file; if ($line) $error_line .= ' on line ' . $line; - $this->errors[] = $error_line + $this->errors[] = $error_line; # TODO: setup a config variable for more detailed stack traces, for API errors. if ( TRUE ){ error_log($error_line);