I can use set_error_handler() to catch most PHP errors, but it doesn\'t work for fatal (E_ERROR) errors, such as calling a function that doesn\'t e
set_error_handler()
E_ERROR
I just came up with this solution (PHP 5.2.0+):
function shutDownFunction() { $error = error_get_last(); // Fatal error, E_ERROR === 1 if ($error['type'] === E_ERROR) { // Do your stuff } } register_shutdown_function('shutDownFunction');
Different error types are defined at Predefined Constants.