By design user-defined error handlers can't handle errors of severity E_ERROR
, E_PARSE
, E_CORE_ERROR
,
E_CORE_WARNING
, E_COMPILE_ERROR
, E_COMPILE_WARNING
and most of E_STRICT
.
Error and Exception Handlers
ThrowErrorException
Throws internal errors as exceptions.
If registered as error handler, this handles an internal PHP error by converting it into an \ErrorException. It respects the error_reporting directive by only throwing an exception if the severity of the internal error is the same or higher than the setting.
Usage:
set_error_handler(new ThrowErrorException());
TriggerExceptionError
Triggers errors for uncaught exceptions.
If registered as exception handler, this catches an uncaught exception and converts it into an internal PHP error of
severity E_USER_ERROR
.
Usage:
set_exception_handler(new TriggerExceptionError());