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
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php