On Thu, May 27, 2004 at 08:50:48AM -0700, Andrei Zmievski wrote:

> Attached is a small patch that can let you do the following. If you set
> a custom error handler via set_error_handler() but don't want to
> implement all the details of handling every single error level, now you
> can simply handle the ones you are interested. Basically, if you return
> 1 from your error handler, then the PHP default error handler gets
> invoked, otherwise nothing happens. So:
> 
>   function my_notice_handler($type, $str, $file, $line, $context)
>   {
>      if ($type == E_NOTICE || $type == E_USER_NOTICE) {
>        /* do something */
>        return false;
>      } else {
>        /* let PHP default handler do it */
>        return true;
>      }
>   }

The convention(*) for these kinds of things is generally to return
'true' when you've handled the message/event and want to discontinue
further processing.  Returning 'false' indicates that you haven't
handled the event.

(*) I don't mean "PHP covention", but this is how most other messaging
systems work when chaining handlers.
 
> It's backwards compatible with previous functionality, i.e. if you don't
> return anything, the default handler does not get invoked.

This argument may overrule my preference, of course.

-- 
Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/)

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to