On Sat, Mar 24, 2012 at 9:26 PM, Nikita Popov <nikita....@googlemail.com> wrote: > Hi internals! > > Laruence and myself yesterday tried to slightly modify the > set_error_handler behavior, but the change which we considered trivial > was not perceived as such by others. So we are taking this to the ML. > > Current state of things: > * set_error_handler(callback) and set_exception_handler(callback) > will return the previous error/exception handler > * set_exception_handler(NULL) will reset the exception handler (i.e. > use the default PHP exception handler again) and return bool(true) > * set_error_handler(NULL) throws an invalid argument error => inconsistent > > What we wanted to do: > Allow the error handler being reset using set_error_handler(NULL). To > be consistent with set_exception_handler(NULL) this was supposed to > return bool(true). > > What people objected to: > * Stas: The bool(true) return value does not really make sense. > Instead the previous error/exception handler should be returned, as > always. > * Pierre: One shouldn't be able to reset the error/exception handler > like that in any case. This behavior should be removed and instead > there should be additional reset_error_handler() and > reset_exception_handler() functions (and also get_error_handler() and > get_exception_handler() if I got that right.) > > What I would do: > Add support for set_error_handler(NULL) and change the return value > of set_error_handler(NULL)+set_exception_handler(NULL) to the previous > handler (i.e. Stas option). I implemented this option in this PR: > https://github.com/php/php-src/pull/20 > > So, what are your opinions on this? I was plan to explain why, but you described very well :)
thanks > > Nikita > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php