Re: Selectable error messages

From: Date: Wed, 18 Jun 2008 12:03:41 +0000
Subject: Re: Selectable error messages
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-38347@lists.php.net to get a copy of this message
Lester Caine wrote:
Short of switching display_errors on and off all the time, how do other people handle this irritation?
I don't have experiences with E_DEPRECATED, but for E_STRICT we use a custom error handler to surpress strict errors in external libraries. Not all E_STRICT errors can be caught in this way, especially not if you are using an opcode cache. Our error handler looks like this, perhaps you can do something similar for E_DEPRECATED.: if (!($errorNumber & error_reporting()) ||
    $errorNumber == E_STRICT &&
    (strpos($fileName, '/pear/') !== false ||
     strpos($fileName, '/smarty/') !== false ||
     preg_match('/^Non-static method (DB|HTTP|Mail_RFC822|PEAR)::/',
                $message))) {
    if ($errorNumber & (E_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR)) {
        exit;
    }
    return;
} // Show error message etc. Christian

« previous php.internals (#38347) next »