Revert "Need to registry the deprecated callback *after* the autoloader is initialized."
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 19 Mar 2010 20:03:50 +0000 (14:03 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 19 Mar 2010 20:37:48 +0000 (14:37 -0600)
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
framework/Core/lib/Horde/Registry.php
horde/lib/core.php

index 3e7ea37..5ee01e5 100644 (file)
@@ -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) {}
+        }
     }
 
     /**
index e106f0f..481a408 100644 (file)
@@ -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');
             }
index 17725e0..63490cf 100644 (file)
@@ -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);
+}