catch does not work because an exception handler is set using set_exception_handler ()
I need to catch in order to work, so I think I need to somehow disable the exception handler. Things like set_exception_handler (NULL) don't work.
Any ideas on how to remove an exception handler?
function my_exception_handler($exception) { error_log("caught exception: " . $exception->getMessage() ); } set_exception_handler("my_exception_handler"); // QUESTION: how does on unset it ? //set_exception_handler(NULL); try { throw new Exception('hello world'); error_log("should not happen"); } catch(Exception $e) { error_log("should happen: " . $e->getMessage()); }
Actual output:
exception found: hello world
Required Conclusion:
should happen: hello world
source share