Don't produce html when running in CLI.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 28 Feb 2010 12:55:01 +0000 (13:55 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 28 Feb 2010 12:58:58 +0000 (13:58 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/platal.inc.php

index 8dd58f4..de9fd8e 100644 (file)
@@ -89,11 +89,15 @@ function pl_error_handler($errno, $errstr, $errfile, $errline)
 
     $type = isset($errortype[$errno]) ? $errortype[$errno] : $errno;
     $errstr = utf8_encode(htmlentities($errstr));
-    $GLOBALS['pl_errors'][] =
-        "<div class='phperror'>".
-        "<strong>{$type}</strong> <em>$errstr</em><br />".
-        "<tt>$errfile : $errline</tt>".
-        "</div>";
+    if (php_sapi_name() == 'cli') {
+        $GLOBALS['pl_errors'] = "$type: $errstr\n  $errfile:$errfile\n";
+    } else {
+        $GLOBALS['pl_errors'][] =
+            "<div class='phperror'>".
+            "<strong>{$type}</strong> <em>$errstr</em><br />".
+            "<tt>$errfile : $errline</tt>".
+            "</div>";
+    }
 }
 
 function pl_clear_errors()