Skip to main content.

Tuesday, September 20, 2005

After discovering about the debug_backtrace function (PHP >= 4.3.0); I was thinking about how wonderful it would be to attach a customized error handler to Nucleus when running in debug mode. This handler could output a stacktrace, which would be much more helpful than a message a la "Tried to call a method on a non-object at code.php line x" when this line of code is buried deep into the code.

Unfortunately -- as I discovered the hard way -- the error handler function that is passed to set_error_handler is never called for fatal errors. This behavior is listed in the manual, but I only bothered to read it carefully once things didn't quite work as expected. The reason why these fatal errors cannot be trapped is that the engine might not be in a stable state. Bummer. An extra class of errors (fatal unless trapped) would certainly be welcome.

Comments

No comments yet

Add Comment

This item is closed, it's not possible to add new comments to it or to vote on it