Bug #9351: Don't try to include non existent vhost specific files
authorGonçalo Queirós <goncalo.queiros@portugalmail.net>
Fri, 29 Oct 2010 17:12:22 +0000 (18:12 +0100)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 29 Oct 2010 20:45:25 +0000 (14:45 -0600)
Signed-off-by: Michael M Slusarz <slusarz@curecanti.org>
framework/Core/lib/Horde.php

index 8ffce13..25af466 100644 (file)
@@ -765,19 +765,21 @@ HTML;
                 : $conf['server']['name'];
             $file = $config_dir . substr($config_file, 0, -4) . '-' . $server_name . '.php';
 
-            self::startBuffer();
-            $success = (is_null($var_names) && !$show_output)
-                ? include_once $file
-                : include $file;
-            $output = self::endBuffer();
+            if (file_exists($file)) {
+                self::startBuffer();
+                $success = (is_null($var_names) && !$show_output)
+                    ? include_once $file
+                    : include $file;
+                $output = self::endBuffer();
+
+                if (!$success) {
+                    throw new Horde_Exception(sprintf('Failed to import configuration file "%s".', $file));
+                } elseif (!empty($output) && !$show_output) {
+                    throw new Horde_Exception(sprintf('Failed to import configuration file "%s": ', $file) . strip_tags($output));
+                }
 
-            if (!$success) {
-                throw new Horde_Exception(sprintf('Failed to import configuration file "%s".', $file));
-            } elseif (!empty($output) && !$show_output) {
-                throw new Horde_Exception(sprintf('Failed to import configuration file "%s": ', $file) . strip_tags($output));
+                $was_included = true;
             }
-
-            $was_included = true;
         }
 
         // Return an error if neither main or vhosted versions of the config