From: Florent Bruneau Date: Sun, 28 Feb 2010 12:55:01 +0000 (+0100) Subject: Don't produce html when running in CLI. X-Git-Tag: core/1.1.0~70 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=4314727805eedd77202a6addef0d3ad4b666f678;p=platal.git Don't produce html when running in CLI. Signed-off-by: Florent Bruneau --- diff --git a/include/platal.inc.php b/include/platal.inc.php index 8dd58f4..de9fd8e 100644 --- a/include/platal.inc.php +++ b/include/platal.inc.php @@ -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'][] = - "
". - "{$type} $errstr
". - "$errfile : $errline". - "
"; + if (php_sapi_name() == 'cli') { + $GLOBALS['pl_errors'] = "$type: $errstr\n $errfile:$errfile\n"; + } else { + $GLOBALS['pl_errors'][] = + "
". + "{$type} $errstr
". + "$errfile : $errline". + "
"; + } } function pl_clear_errors()