Re: [Zend Engine 2] Errors and exceptions?
| From: | Derick Rethans | Date: | Tue, 12 Nov 2002 06:54:58 +0000 |
| Subject: | Re: [Zend Engine 2] Errors and exceptions? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90840@lists.php.net to get a copy of this message | ||
On 12 Nov 2002, Timm Friebe wrote:
> On Mon, 2002-11-11 at 23:26, Stig S. Bakken wrote:
> [...]
> > > The problem here is that PHP's E_WARNING does not resemble an exception.
> > > Some of the warnings raised are only of informational intent and do not
> > > indicate the failure of a function.
> [...]
> > Right. What this illustrates is that "PHP errors" as such as way too
> > random and unstructured to be of any other use than showing error
> > messages to developers.
>
> Well, would it be wise then to either:
> * Change informational warnings to E_NOTICE
> (e.g. Notice: Called ... before fetching all rows ...)
> or
> * Introduce E_FAIL and use it for cases when a function fails
> (say, fopen('/doesnotexist', 'r'))
>
> In both cases, people doing string magic with $php_errormsg (if
> ereg("not exist", $php_errormsg)) or having their own error handlers
> consisting of constructs like
> if (E_WARNING == $code)
> would see their code break.
>
> As for the first suggestion, the downside is that a lot of people will
> miss the message(s) since they've disabled E_NOTICEs.
And that's why I would be -1 on the first one. However, the whole error
reporting is a pretty mess, with some extensions implementing other
'philosiphies' then others. Getting this all nice and clean is another
point we should address in PHP 5 (just like Stig mentioned).
Derick
--
---------------------------------------------------------------------------
Derick Rethans http://derickrethans.nl/
JDI Media Solutions http://www.jdimedia.nl/
---------------------------------------------------------------------------