Re: error_handler

From: Date: Fri, 19 Dec 2003 14:43:33 +0000
Subject: Re: error_handler
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-6602@lists.php.net to get a copy of this message
Daniel Convissor wrote:
On Fri, Dec 19, 2003 at 03:20:17PM +0100, Derick Rethans wrote:
It is when it's optional and the default is the current behavior.
Pardon me. Looks like PHP 3 behavior is still stuck in my brain...
No, you were right. A script using set_error_handler("handler", error_reporting()); will get "Wrong parameter count for set_error_handler()" for PHP4. So you force people to lock their code to PHP5 if they want to use the new semantics. Not good for migration. Another approach would be that set_error_handler() copies the current error_reporting mask. But that leads to confusing situations if error_reporting is changed later on. Would need good documentation to explain it. After thinking about it I come to the conclusion that coupling the error handler to error_reporting is the right thing to do. I believe we can live with the _very_ rare case where people expect the error handler to be called for everything *AND* they have error_reporting to something else than E_ALL. That would also remove a WTF-situation (I was quite surprised when my error handler got called for E_NOTICE even though I disabled it in error_reporting). - Chris

« previous php.internals (#6602) next »