I have set an exception handler in my PhP program using set_exception_handler() and it actually works fine. In the sense, it does catch exceptions not otherwise handled by me, and as provided in the handler, logs the exception details. So, why am I complaining? Problem is that in addition to logging the correct details with file name and line number in the exception handler, it also displays the following message in the browser:
Fatal error: Exception thrown without a stack frame in Unknown on line 0 My belief is that perhaps this specific exception message is coming from stdout stream while the exceptions been caught by the handler are from the stderr stream. The other possibility is that the above message is emitted by the error handler module and not the exception handler module of PhP. In any event, I would like all exception messages to go to one handler. I also have a error handler set as follows:
set_error_handler('SS_error_handler', E_ALL); How are such situations handled? Is the Fatal error message coming from PhP's error message reporting module? If so, is there an overlap between the exception handler and the error handler in the sense that they both get triggered on certain errors/exceptions? If relevant, I would like to add that this specific exception is thrown be a MySQL PDO statement.
Any explanation would be appreciated.