function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
switch ($errno) {
case E_USER_ERROR:
- echo "ERROR: [$errno] $errstr ($errfile:$errline)\n";
- echo " Fatal error on line $errline in file $errfile";
- echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
- echo "Aborting...\n";
+ common_log(LOG_ERR, "[$errno] $errstr ($errfile:$errline)");
exit(1);
break;
case E_USER_WARNING:
- echo "WARNING [$errno] $errstr ($errfile:$errline)\n";
+ common_log(LOG_WARNING, "[$errno] $errstr ($errfile:$errline)");
break;
case E_USER_NOTICE:
- echo "NOTICE [$errno] $errstr ($errfile:$errline)\n";
+ common_log(LOG_NOTICE, "[$errno] $errstr ($errfile:$errline)");
break;
}
+ # FIXME: show error page if we're on the Web
/* Don't execute PHP internal error handler */
return true;
}