> die("foo");
> 
> vs.
> 
> trigger_error("foo", E_USER_ERROR);
> 
> is IMO a complication.
>
> > If we leave errors unhandled in examples, that is simple,
> > but harms the developers. I do think, that using too much
> > error handling code in examples hurts, but none is not
> > better...
> 
> right, die() works fine for that.

OK, let die() stay there. BUT big notes should be added to the
die() docs then about unsafe usage (to print out error messages
to users). So if someone is interested in what die() does, he
get some explanation on why he should *not* use it (despite the
fact that it is used in examples).

BTW I was quite surprised from the first moment I have used
user_error() / trigger_error() that its default is *not*
E_USER_ERROR. I expected it to default to E_USER_ERROR, because

 1. It's name is ..._error()
 2. Generally all errors handled with these functions should stop
    the script run anyway IMHO...

Although I can see that it's my point of view and may not be
others... I would also love to see some shorter aliases for
these error constants. Now I define() my own shortcut constants
for those. Uh, I am going comletely offtrack now :)

Goba



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to