I have the following code to setup my error/exception handlers:
// Set the exception handler
set_exception_handler(function($e) {
echo 'Exception';
});
// Set the error handler
set_error_handler(function($code, $message, $file, $line) {
throw new ErrorException($message, 0, $code, $file, $line);
});
I have read numerous articles which have said to throw an exception within the set_error_handler callback function. This should mean I only have to handle exceptions. However the set_exception_handler callback function is never called and instead I get the warning:
Warning: Uncaught exception 'ErrorException' with message...
Please note that I am using PHP 5.4.