Re: [VOTE] Allowing use of exceptions in the engine
| From: | Nikita Popov | Date: | Sun, 08 Dec 2013 11:48:42 +0000 |
| Subject: | Re: [VOTE] Allowing use of exceptions in the engine | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70528@lists.php.net to get a copy of this message | ||
On Sat, Dec 7, 2013 at 6:05 PM, Ferenc Kovacs <tyra3l@gmail.com> wrote:
> personally I have seen catch-all blocks in the wild (try {//do something}
> catch(Exception $e) {//do nothing}), which would behave differently (and
> some of them would screw something up instead of terminating the app) if
> the EngineException is a subclass of Exception.
> I can see myself supporting this proposal for 5.6, if we can have it done
> in a truly BC-safe manner, but I can understand, if the required
> compromises for that would make the feature too "clunky", so maybe it would
> be better to introduce it in a major version.
>
I'm not sure I see how catch-all blocks relate to BC-safety as far as
E_ERROR is concerned. If an engine exception is accidentally caught by a
catch-all block, it means that previously it was throwing a fatal error,
which means that your code didn't work anyway - in all likeliness you were
getting a WSOD or ISE. The catch-all block will not break the code (it is
already broken), it will only change the way in which it fails (or prevent
it from failing altogether). Of course, unintentionally missing an error
*is* an issue, but it's not an issue of BC.
Nikita