Re: set_exception_handler catches all Throwables

From: Date: Wed, 19 Aug 2015 13:55:16 +0000
Subject: Re: set_exception_handler catches all Throwables
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-87800@lists.php.net to get a copy of this message
On Aug 19, 2015 6:44 AM, "Björn Larsson" <bjorn.x.larsson@telia.com> wrote: > > Plan to migrate to PHP 7 later, like the new Exception/Error way > of working very much. Point is that current set_exception_handler > only address exceptions, not errors. You are right that on that the > surface it's the same callback, but could eg be logging in different > ways and to different recipients. Will look into it more later. > > Regards, //Björn > > > Den 2015-08-19 kl. 13:30, skrev Niklas Keller: >> >> What do you guys do in the set_exception_handler callback? Wouldn't most code just use the same callback and just log the error / exception? >> >> Regards, Niklas >> >> 2015-08-19 11:55 GMT+02:00 Björn Larsson <bjorn.x.larsson@telia.com <mailto:bjorn.x.larsson@telia.com>>: >> >> >> Den 2015-08-19 kl. 10:52, skrev Peter Cowburn: >> >> On 17 August 2015 at 15:24, Sebastian Bergmann >> <sebastian@php.net> wrote: >> >> Am 17.08.2015 um 16:00 schrieb Derick Rethans: >> >> Actually, I don't call this intended. This is just as >> much as a BC break >> as the original implementation where Errors where also >> Exceptions. IMO, >> set_exception_handler() should be changed - with my >> preference it not >> capturing Error, and instead have an additional >> set_throwable_handler(). >> >> +1 >> I agree with this completely. I think the point here is that catch(Exception $e) remains unchanged while setting a handler actually catches more things now. Tbh I feel like this is an oversight in implementing the Error/Throwable rfc and should be addressed now, otherwise it can't be changed until 8 if I understand correctly.

« previous php.internals (#87800) next »