From de6151b27c4a57cddd8ddd7991cd9de1378571fa Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 14 Aug 2007 02:54:08 +0000 Subject: [PATCH] Remvoing all the methods in BSRegister that handle error reporting * Register.php: (BSRegister::Message): Removed (BSRegister::_errorHandler): Removed (BSRegister::ExplainErrorReporting): Removed --- Register.php | 166 +-------------------------------------------------- 1 file changed, 2 insertions(+), 164 deletions(-) diff --git a/Register.php b/Register.php index bed8ccf..053a395 100644 --- a/Register.php +++ b/Register.php @@ -127,7 +127,8 @@ class BSRegister /** * Constructor */ - private function __construct() {} + private function __construct() + {} // ################################################################### /** @@ -142,7 +143,6 @@ class BSRegister if (!self::$instance) { self::$instance = new BSRegister(); - set_error_handler(array(self::$instance, '_errorHandler')); } return self::$instance; } @@ -405,169 +405,7 @@ class BSRegister return new $class; } - - // ################################################################### - /** - * Prints an ISSO message - * - * @param string The title of the message - * @param string The content of the message - * @param integer Type of message to be printed - * @param bool Return the output? - * @param bool Show the debug stack? - * @param integer Message width - * - * @return mixed Output or null - */ - public static function Message($title, $message, $type, $return = false, $stack = true, $width = 500) - { - switch ($type) - { - // Message - case 1: - $prefix = 'Message'; - $color = '#669900'; - $font = '#000000'; - break; - - // Warning - case 2: - $prefix = 'Warning'; - $color = '#003399'; - $font = '#FFFFFF'; - break; - - case 3: - $prefix = 'Error'; - $color = '#990000'; - $font = '#EFEFEF'; - break; - } - - echo "\n
\n"; - echo "\n\n\t\n"; - echo "\n\n\t\n"; - if ($stack AND self::_Instance()->getDebug()) - { - echo "\n\n\t\n"; - } - echo "\n
$prefix: $title
$message
Debug Stack:
";
-			echo BSFunctions::FormatBacktrace(debug_backtrace());
-			echo "
\n
\n"; - } - - // ################################################################### - /** - * Custom error handler for ISSO; only handle E_WARNING, E_NOTICE, - * E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE - * - * @param integer Error number - * @param string Error message string - * @param string File that contains the error - * @param string The line number of the error - * @param string The active symbol table at which point the error occurred - */ - public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) - { - $level = ini_get('error_reporting'); - - switch ($errno) - { - // So we don't need to specify the error type in trigger_error(), all E_USER_NOTICEs - // are fatal and automatically kill the script - case E_USER_NOTICE: - $title = 'Fatal'; - $mode = 3; - break; - - // A non-fatal but important warning - case E_WARNING: - $title = 'Warning'; - $mode = 2; - if (!($level & E_WARNING)) - { - return; - } - break; - - // A non-fatal notice that should all but be ignored unless in dev environments - case E_NOTICE: - case E_STRICT: - $title = 'Notice'; - $mode = 1; - if (!($level & E_NOTICE)) - { - return; - } - break; - - case E_USER_WARNING: - case E_USER_NOTICE: - default: - trigger_error('The only error types supported are E_USER_NOTICE (fatal), E_WARNING, and E_NOTICE'); - break; - } - - // change the file and line of the error so we aren't looking at the location of the trigger_error() - $backtrace = debug_backtrace(); - if (isset($backtrace[1]) AND $backtrace[1]['function'] == 'trigger_error' AND isset($backtrace[2]['file'])) - { - $errfile = $backtrace[2]['file']; - $errline = $backtrace[2]['line']; - } - - $errstr .= " in $errfile on line $errline"; - $errstr = str_replace(array(getcwd(), dirname(getcwd())), '', $errstr); - - self::Message($title, $errstr, $mode); - - if ($errno == E_USER_NOTICE) - { - exit; - } - } - - // ################################################################### - /** - * Creates a table that explains the error reporting levels and their - * state - */ - public static function ExplainErrorReporting() - { - $levels = array( - 'E_ERROR' => E_ERROR, - 'E_WARNING' => E_WARNING, - 'E_PARSE' => E_PARSE, - 'E_NOTICE' => E_NOTICE, - 'E_CORE_ERROR' => E_CORE_ERROR, - 'E_CORE_WARNING' => E_CORE_WARNING, - 'E_COMPILE_ERROR' => E_COMPILE_ERROR, - 'E_COMPILE_WARNING' => E_COMPILE_WARNING, - 'E_USER_ERROR' => E_USER_ERROR, - 'E_USER_WARNING' => E_USER_WARNING, - 'E_USER_NOTICE' => E_USER_NOTICE, - 'E_ALL' => E_ALL, - 'E_STRICT' => E_STRICT - ); - - $table = ''; - - foreach ($levels AS $name => $value) - { - $table .= ' - - - - '; - } - - $table .= ' -
' . $name . '' . (ini_get('error_reporting') & $value) . '
'; - - self::Message('Error Reporting', $table, 1); - } - // ################################################################### /** * This function is used by other framework modules to check and see if -- 2.43.5