cosmetic error msg - somehow debug_backtrace seems to lack context sometimes
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 11 Feb 2011 16:12:23 +0000 (17:12 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 11 Feb 2011 16:12:23 +0000 (17:12 +0100)
php/plc_api.php

index cb7257a..4850bfa 100644 (file)
@@ -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()