Re: [RFC] Exceptions in the engine
| From: | Joe Watkins | Date: | Fri, 25 Oct 2013 19:41:04 +0000 |
| Subject: | Re: [RFC] Exceptions in the engine | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69871@lists.php.net to get a copy of this message | ||
On 10/25/2013 08:20 PM, Stas Malyshev wrote:
Hi!Catch all and error handling hacks to ignore fatals are covered in the RFC, I think satisfactorily, mostly ... I haven't really thought about it too much, it just seemed a bit silly to rely on what is essentially shutdown ... I'm liking the idea of BaseException, for this, and in general, would allow us to avoid the problem of catch all blocks, or at least the ones that are in existence now ... If we really wanted to, we could fix all the code that throws the base Exception, making them throw specialized types, as they should, and include a compiler check that finds catch(Exception) blocks and complains, it shouldn't really be valid, we could encourage people to do things the right way in the hope that someday we won't have to worry about catch all blocks when looking to make improvements ... Cheers JoeHow could anything be reliant on the behaviour of a fatal error in any meaningful way ??If condition X did not occur, fatal error would happen, so in the following code I can safely assume condition X is true without checking it. That logic of course would completely break with non-fatal fatal errors, both in C and in PHP. Oh yes, and people do try {...} catch(Exception e) { /* ignore exceptions */} all the time (without, of course, counting fatal errors as being ignored).