According to the comment on this answer it is possible to catch Fatal Errors through a shutdown function which cannot be caught using set_error_handler()
.
However, I couldn't find out how to determine if the shutdown has occured due to a fatal error or due to the script reaching its end.
Additionally, the debug backtrace functions seem to be defunct in the shutdown function, making it pretty worthless for logging the stack trace where the Fatal Error occured.
So my question is: what's the best way to react on Fatal Errors (especially undefined function calls) while keeping the ability to create a proper backtrace?