Bug #8017: App might not have Mime driver config
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 20 Feb 2009 18:38:52 +0000 (11:38 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 20 Feb 2009 18:38:52 +0000 (11:38 -0700)
framework/Mime/lib/Horde/Mime/Viewer.php

index 0b72ab6..f65d25e 100644 (file)
@@ -113,7 +113,7 @@ class Horde_Mime_Viewer
             return self::$_drivercache[$sig];
         }
 
-        /* Make sure 'horde' mime_drivers config is loaded. */
+        /* Make sure horde config is loaded. */
         if (empty(self::$_config['mime_drivers']['horde'])) {
             $res = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'horde');
             if (is_a($res, 'PEAR_Error')) {
@@ -122,14 +122,14 @@ class Horde_Mime_Viewer
             self::$_config = $res;
         }
 
-        /* Make sure app's' mime_drivers config is loaded. */
+        /* Make sure app's config is loaded. There is no requirement that
+         * an app have a separate config, so ignore any errors. */
         if (($app != 'horde') && empty(self::$_config['mime_drivers'][$app])) {
             $res = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), $app);
-            if (is_a($res, 'PEAR_Error')) {
-                return false;
+            if (!is_a($res, 'PEAR_Error')) {
+                require_once 'Horde/Array.php';
+                self::$_config = Horde_Array::array_merge_recursive_overwrite(self::$_config, $res);
             }
-            require_once 'Horde/Array.php';
-            self::$_config = Horde_Array::array_merge_recursive_overwrite(self::$_config, $res);
         }
 
         $driver = '';