On Wed, Jun 2, 2010 at 7:41 AM, Chad Fulton <chadful...@gmail.com> wrote: > Hi! > >> Pretty much everywhere. Suppose you have form with, say, 2 fields and first >> field does not validate. Maybe you want to check the second field too and >> give the user both errors if they are both wrong? >> >> In general, looking at strict typing as user input validation mechanism is a >> very bad idea. There are specialized use input validation >> functions/classes/frameworks, and one should use them. > > Right, that was my point. I can't think of any good reason to use > exceptions rather than global errors (E_NOTICE or E_STRICT or > similar), but some people seem to want exceptions. > > I was asking them if they had use valid cases (e.g. *not* data > validation or similar which is undoubtably foolish) that would merit > using exceptions rather than the global error handling.
Regardless of whether it's used for validation (which I agree is a bad idea), type errors may still occur elsewhere in the code; being able to handle those errors using exceptions has the advantage of keeping the context; a custom error handler lacks this and wouldn't be able to distinguish between errors, let alone be able to show the end-user any decent feedback. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -- Tjerk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php