note 96615 modified in errorexception.getseverity by danbrown

From: Date: Mon, 08 Mar 2010 15:05:15 +0000
Subject: note 96615 modified in errorexception.getseverity by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166779@lists.php.net to get a copy of this message
Try this as replacement for error_reporting(...) <?php function exception_error_handler($errno, $errstr, $errfile, $errline ) { $severity = 1 * E_ERROR | 1 * E_WARNING | 0 * E_PARSE | 0 * E_NOTICE | 0 * E_CORE_ERROR | 0 * E_CORE_WARNING | 0 * E_COMPILE_ERROR | 0 * E_COMPILE_WARNING | 0 * E_USER_ERROR | 0 * E_USER_WARNING | 0 * E_USER_NOTICE | 0 * E_STRICT | 0 * E_RECOVERABLE_ERROR | 0 * E_DEPRECATED | 0 * E_USER_DEPRECATED; $ex = new ErrorException($errstr, 0, $errno, $errfile, $errline); if ($ex->getSeverity & $severity != 0) { throw $ex; } ?> } set_error_handler("exception_error_handler"); --was-- Try this as replacement for error_reporting(...) function exception_error_handler($errno, $errstr, $errfile, $errline ) { $severity = 1 * E_ERROR | 1 * E_WARNING | 0 * E_PARSE | 0 * E_NOTICE | 0 * E_CORE_ERROR | 0 * E_CORE_WARNING | 0 * E_COMPILE_ERROR | 0 * E_COMPILE_WARNING | 0 * E_USER_ERROR | 0 * E_USER_WARNING | 0 * E_USER_NOTICE | 0 * E_STRICT | 0 * E_RECOVERABLE_ERROR | 0 * E_DEPRECATED | 0 * E_USER_DEPRECATED; $ex = new ErrorException($errstr, 0, $errno, $errfile, $errline); if ($ex->getSeverity & $severity != 0) { throw $ex; } } set_error_handler("exception_error_handler"); http://php.net/manual/en/errorexception.getseverity.php

« previous php.notes (#166779) next »