From 4150901728c63178e8197d8e26802cd2fcab2b57 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 22 Jan 2005 23:20:44 +0000 Subject: [PATCH] Changed ERR_ERROR to ERR_ALERT. Added PHP5 fix for error reporting. Error handler now checks to make sure error_reporting is right. --- kernel.php | 24 ++++++++++++++++++++++-- template.php | 2 +- template_fs.php | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/kernel.php b/kernel.php index 1042bd3..408bbf6 100644 --- a/kernel.php +++ b/kernel.php @@ -11,7 +11,7 @@ \*=====================================================================*/ define('ERR_FATAL', E_USER_ERROR); -define('ERR_ERROR', E_USER_WARNING); +define('ERR_ALERT', E_USER_WARNING); define('ERR_WARNING', E_USER_NOTICE); if (PHP_VERSION < '4.1.0') @@ -20,6 +20,14 @@ if (PHP_VERSION < '4.1.0') exit; } +if (PHP_VERSION > '5.0.0') +{ + if (ini_get('error_reporting') & E_USER_NOTICE) + { + error_reporting(ini_get('error_reporting') - E_USER_NOTICE); + } +} + if ((bool)ini_get('register_globals') === true) { $superglobals = array('_GET', '_COOKIE', '_FILES', '_POST', '_SERVER', '_ENV'); @@ -262,17 +270,29 @@ class Shared_Object_Framework // Fatal case ERR_FATAL: $title = 'Fatal'; + if (!(ini_get('error_reporting') & ERR_FATAL)) + { + return; + } break; // Error - case ERR_ERROR: + case ERR_ALERT: $title = 'Alert'; + if (!(ini_get('error_reporting') & ERR_ALERT)) + { + return; + } break; // Warning case ERR_WARNING: default: $title = 'Warning'; + if (!(ini_get('error_reporting') & ERR_WARNING)) + { + return; + } break; } diff --git a/template.php b/template.php index 32ff561..9ff7b34 100644 --- a/template.php +++ b/template.php @@ -454,7 +454,7 @@ class DB_Template // um... wtf? if (count($data) > 2) { - trigger_error('Multiple else statements encountered while parsing conditionals in template', ERR_ERROR); + trigger_error('Multiple else statements encountered while parsing conditionals in template', ERR_ALERT); } // Set the data diff --git a/template_fs.php b/template_fs.php index 541b1b0..0c23d69 100644 --- a/template_fs.php +++ b/template_fs.php @@ -51,7 +51,7 @@ class FS_Template extends DB_Template { if (sizeof($this->cache) > 0) { - trigger_error('You cannot cache templates more than once per initialization', ERR_WARNING); + trigger_error('You cannot cache templates more than once per initialization', ERR_ALERT); } else { -- 2.43.5