Re: Exceptions and Errors
| From: | Adam Maccabee Trachtenberg | Date: | Mon, 12 Apr 2004 17:05:18 +0000 |
| Subject: | Re: Exceptions and Errors | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9075@lists.php.net to get a copy of this message | ||
On Mon, 12 Apr 2004, Greg Beaver wrote:
> Adam Maccabee Trachtenberg wrote:
>
> > I am willing to concede that SQL parse errors aren't the best example
> > here, but that doesn't mean extensions should never throw exceptions.
>
> If a user has written code expecting it to work in PHP 4 and PHP 5 with
> a registered error handler, it has to be completely rewritten.
If you're expecting this code to work in both PHP 4 and PHP 5, you're
not using the OO extension interface, so no exceptions will be
thrown. Things will work just like before.
I also presume that exceptions are not handled by a registed error
handler. That would be madness. :)
I think by now I am resigned to the situation that PHP's internal
error reporting system doesn't doesn't map well to exception
handling.
This problem is at least somewhat related to inconsistent application
of E_WARNINGs, E_ERRORs, etc. Certain extensions (SOAP, Ming) love to
throw E_ERRORs. Others won't throw an E_ERROR in even the worst of
circumstances. Therefore, sometimes E_WARNINGs are harmless and other
times they're fatal.
Oh well.
-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!