An exception is thrown in my shutdown function and not caught within a try/catch block, for example:
<?php
set_exception_handler(function($e){
echo "exception handled"; // not echoed
});
register_shutdown_function(function(){
throw new Exception("test"); // this should be caught by the exception handler above, but it doesn't
});
Running the above code gives:
Fatal error: Uncaught exception 'Exception' with message 'test'
However PHP Manual claims:
set_exception_handler sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the exception_handler is called.
Why does exception_handler
not catch the exception thrown?