} $fileLine = "on line {$line} in "; if (isset($_SERVER['DOCUMENT_ROOT'])) { $fileLine .= File::relativePath($file, $_SERVER['DOCUMENT_ROOT']); } elseif (isset($GLOBALS['argv'][0])) { $fileLine .= File::relativePath($file, dirname($GLOBALS['argv'][0])); } else { $fileLine .= $file; } switch ($errno) { case E_PARSE: case E_USER_ERROR: case E_ERROR: break; case E_NOTICE: case E_USER_NOTICE: if (PHP::isCLI()) { IO::writeError("{$GLOBALS['argv'][0]}: WARNING: {$str} {$fileLine}\n"); } else { error_log("WARNING: {$str} {$fileLine}"); } return; } if (PHP::isCLI()) { IO::writeError("{$GLOBALS['argv'][0]}: FATAL: {$str} {$fileLine}\n\t" . str_replace("\n", "\n\t", ABException::formatTrace(new Exception(), false, array('__errhandler'))) . "\n"); } else { $s = ABException::formatTrace(new Exception(), true, array('__errhandler')); error_log("FATAL: {$str} ({$fileLine}) {$s}"); print "<div class=\"err\"><b>FATAL:</b> {$str} <span class=\"file\">{$fileLine}</span>\n" . '<div class="trace">' . $s . '</div>' . '</div>'; } exit(1);
/** * Print something to stderr * * @param mixed * @return void * @deprecated Use {@link IO::writeError()} instead */ public static function printError($str) { IO::writeError($str); }