Do you know any solution to recover from the PHP fatal error : \"Allowed memory size ... exhausted\"
I have a shutdown function that is called when a fatal
The regular way to customize error handling is through
set_error_handler — Sets a user-defined error handler function
The docs for this function state (emphasis mine):
The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
So, it won't work regularly, but you can try
As of PHP7, Errors and Exceptions are Throwables, so you can try/catch them: