I'm writing a custom error handler. I'm wondering how to handle errors inside my error handler. Can I call trigger_error() inside the error handler or will it result in an infinite loop?
set_error_handler('error_handler_function');
function error_handler_function($error_type,
$error_msg,
$error_file,
$error_line,
$error_context) {
switch($error_type) {
case E_ERROR:
// this should never happen
case E_USER_ERROR:
// echo? die?
break;
case E_WARNING:
case E_USER_WARNING:
// echo? die?
break;
case E_NOTICE:
case E_USER_DEFAULT:
// echo? die?
break;
default:
// UNRECOGNIZED ERROR TYPE
trigger_error("UNRECOGNIZED ERROR TYPE", E_USER_ERROR);
} // switch error type
}