Re: Re: Are exceptions allowed in php core?
| From: | Anthony Ferrara | Date: | Fri, 31 Aug 2012 17:03:15 +0000 |
| Subject: | Re: Re: Are exceptions allowed in php core? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62611@lists.php.net to get a copy of this message | ||
Ferenc,
>> Not for PHP 5.5 (if that's happening?), but for PHP 6 I think a lot of
> > things should become exceptions.
>
>
> From the impression that I get from reading through the mailing list
> threads and the irc discussions I think that there aren't that many things
> that could turn into exceptions.
> E_RECOVERABLE_ERROR and probably that's it.
Actually, from my look at it, almost all E_WARNINGs, a number of E_NOTICEs
(the ones that make sense to transition, like array to string cast),
E_RECOVERABLE and certain E_ERROR (such as call to undefined method, etc)
can be turned pretty easily. The ones that can't (without significant
change to the engine at least) are deeper E_ERROR, E_CORE_*, and E_PARSE...
Take a look at the library I am linking to deeper down. All of those errors
are core thrown errors that can be easily turned into exceptions. Plus the
E_ERROR that I couldn't, but we can in core (again, call to undefined
method, etc)...
> > I don't think that, personally, PHP's current error handling system is
> > sufficient for properly handling errors.
>
>
> It is working for years, it could be improved but I wouldn't call it
> insufficient.
Any system where it's **harder** to handle the error properly than to
ignore it is insufficient in my book. The fact that you need something like
this: https://github.com/ircmaxell/ErrorExceptions
to handle errors
properly as exceptions (to be notified not that an error occured, but the
type of error) is indicative of that...
Anthony