JosephLenton / PHP-Error

Better error reporting for PHP, and prettier too!
1.35k stars 151 forks source link

allow PHP Error to let existing handlers, go first #69

Open JosephLenton opened 11 years ago

JosephLenton commented 11 years ago

Currently, PHP Error replaces any existing handlers, and just forces it's self to become the main handler. The problem here, is that people are using PHP Error with existing code, which has existing error handlers.

So PHP Error needs some mechanism for working with these in different ways, and some policy about how it works in relation to others.

According to the PHP docs, a handler is supposed to return true, if the error has been handled. So in theory, PHP Error could run any existing handler set before it, and only run if that handler failed to return true.

The debate comes down to what the default context should be. The way I see it, the options are:

The default behaviour can be decided later, but for now the code should be changed to capture any existing handlers, and allow them to be run before the current handler. A boolean option can then decide if that is on or not (with the default set in the __construct).