RE: [PHP-DEV] [RFC] Exceptions in the engine

From: Date: Fri, 25 Oct 2013 14:09:16 +0000
Subject: RE: [PHP-DEV] [RFC] Exceptions in the engine
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-69867@lists.php.net to get a copy of this message
> -----Original Message----- > From: Jordi Boggiano [mailto:j.boggiano@seld.be] > Sent: 25 October 2013 15:03 > To: Richard Bradley > Cc: Joe Watkins; internals@lists.php.net; Larry Garfield > Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine > > On Fri, Oct 25, 2013 at 3:55 PM, Richard Bradley <Richard.Bradley@softwire.com> wrote: > >> How could anything be reliant on the behaviour of a fatal error in any meaningful way > >> ?? > >> > >> Cheers > >> Joe > > > > In plenty of ways: for example currently frameworks can "catch" fatal errors > > using "register_shutdown_function" and display an error page to the end user (say if there > > is an attempt to call a method on a null object due to an unanticipated runtime error). > > > > Current frameworks might be broken if the way fatal errors work is changed. That would be > > a BC break. > > > > See e.g. > > > > http://stackoverflow.com/questions/16284235/zend-framework-error-page- > > for-php-fatal-errors/16284260#16284260 > > > > (This is not a vote for or against this proposal; I'm just answering > > the immediate parent here.) > > Wouldn't this sort of use case be covered by the fact that an uncaught exception would > still result in a fatal error? The only case it'd "break" is if you have a try/catch > around your entire application, before you had to listen to have a shutdown handler but now your > catch would catch the fatal exceptions before they bring everything down. You might still end up in the register_shutdown_function yes, but the error code would have changed (from error_get_last()) i.e. people may well be relying on the exact behaviour of fatal errors. It would be great to fix the somewhat messy state of exceptions & errors in PHP, but we shouldn't pretend that we can do so without BC breaks. Richard Bradley Tel : 020 7485 7500 ext 3230 | Fax : 020 7485 7575 softwire Sunday Times Best Small Companies - UK top 20 three years running Web : www.softwire.com | Addr : 325 Highgate Studios, 53-79 Highgate Road, London NW5 1TL Softwire Technology Limited. Registered in England no. 3824658. Registered Office : 13 Station Road, London N3 2SB

« previous php.internals (#69867) next »