Fix problems with the Horde::errorHandler() call.
authorGunnar Wrobel <p@rdus.de>
Mon, 6 Dec 2010 07:48:39 +0000 (08:48 +0100)
committerGunnar Wrobel <p@rdus.de>
Mon, 6 Dec 2010 07:48:39 +0000 (08:48 +0100)
I currently get a fatal error whithin dynamic Imp (WSOD). Apparently
Horde::errorHandler() gets called during shutdown. The stack trace I
get from the error that Horde::errorHandler() tries to log looks like
this:

Stack trace:
#0 [internal function]: Horde::errorHandler('<!DOCTYPE html ...', 5)
#1 [internal function]: ob_gzhandler()
#2 {main}

While I still need to identify the source of this error I believe the
logMessage() method should always ensure it can actually log
something.

framework/Core/lib/Horde.php

index feb8385..0b5da57 100644 (file)
@@ -86,6 +86,9 @@ class Horde
     static public function logMessage($event, $priority = null,
                                       array $options = array())
     {
+        if (!isset($GLOBALS['injector'])) {
+            throw new Horde_Exception('The default environment is missing. Unable to write log entries!');
+        }
         $options['trace'] = 2;
         $GLOBALS['injector']->getInstance('Horde_Log_Logger')->log($event, $priority, $options);
     }