From f2aa922463ac2d2d7b1de4de4c63116232070f4d Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 11 Feb 2011 17:12:23 +0100 Subject: [PATCH] cosmetic error msg - somehow debug_backtrace seems to lack context sometimes --- php/plc_api.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/php/plc_api.php b/php/plc_api.php index cb7257a..4850bfa 100644 --- a/php/plc_api.php +++ b/php/plc_api.php @@ -49,8 +49,11 @@ class PLCAPI $file = $backtrace[$backtrace_level]['file']; $line = $backtrace[$backtrace_level]['line']; - $this->errors[] = 'PLCAPI error: ' . $error_msg . ' in ' . $file . ' on line ' . $line; - error_log(end($this->errors)); + $error_line='PLCAPI error: ' . $error_msg ; + if ($file) $error_line .= ' in file ' . $file; + if ($line) $error_line .= ' on line ' . $line; + $this->errors[] = $error_line; + error_log($error_line); } function error() -- 2.43.0