From a68fbe3eb4e44bfff12d4c2163ae33919075e52c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 19 Mar 2010 14:03:50 -0600 Subject: [PATCH] Revert "Need to registry the deprecated callback *after* the autoloader is initialized." This reverts commit 87562acdb7337553fcbb432b9bbff4307136c8b2. Just ignore Exceptions that are thrown if the logging handler is not yet setup. And don't try to log at all if log handler is not yet available. --- framework/Core/lib/Horde.php | 10 ++++++++-- framework/Core/lib/Horde/Registry.php | 4 ---- horde/lib/core.php | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 3e7ea37fa..5ee01e541 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -136,7 +136,9 @@ class Horde // Log the error via logMessage() if requested. if ($log) { - self::logMessage($error, 'EMERG'); + try { + self::logMessage($error, 'EMERG'); + } catch (Exception $e) {} } if ($cli) { @@ -164,7 +166,11 @@ HTML; static public function logDeprecated($errno, $errstr, $errfile, $errline, $errcontext) { - self::logMessage(new ErrorException($errstr, 0, $errno, $errfile, $errline), 'DEBUG'); + if (class_exists('Horde_Log')) { + try { + self::logMessage(new ErrorException($errstr, 0, $errno, $errfile, $errline), 'DEBUG'); + } catch (Exception $e) {} + } } /** diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index e106f0f5f..481a408f3 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -184,10 +184,6 @@ class Horde_Registry try { $GLOBALS['registry']->pushApp($app, array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => !$args['nologintasks'])); - /* Catch and log E_DEPRECATED errors. */ - if (defined('E_DEPRECATED')) { - set_error_handler(array('Horde', 'logDeprecated'), E_DEPRECATED); - } if ($args['admin'] && !Horde_Auth::isAdmin()) { throw new Horde_Exception('Not an admin'); } diff --git a/horde/lib/core.php b/horde/lib/core.php index 17725e0bb..63490cf90 100644 --- a/horde/lib/core.php +++ b/horde/lib/core.php @@ -42,3 +42,7 @@ Horde_Autoloader::addClassPattern('/^Horde(?:$|_)/i', dirname(__FILE__)); * output this unless an admin. */ set_exception_handler(array('Horde', 'fatal')); +/* Catch and log E_DEPRECATED errors. */ +if (defined('E_DEPRECATED')) { + set_error_handler(array('Horde', 'logDeprecated'), E_DEPRECATED); +} -- 2.11.0