[Fusionforge-commits] r9359 - trunk/gforge/common/include

Olivier Berger olberger at libremir.placard.fr.eu.org
Tue Apr 6 10:03:06 CEST 2010


Author: olberger
Date: 2010-04-06 10:03:05 +0200 (Tue, 06 Apr 2010)
New Revision: 9359

Modified:
   trunk/gforge/common/include/config.php
Log:
Fix warning on non-existing file and foreach error


Modified: trunk/gforge/common/include/config.php
===================================================================
--- trunk/gforge/common/include/config.php	2010-04-04 16:40:09 UTC (rev 9358)
+++ trunk/gforge/common/include/config.php	2010-04-06 08:03:05 UTC (rev 9359)
@@ -52,14 +52,18 @@
 	}
 
 	function read_config_file ($file) {
-		$sections = parse_ini_file ($file, true) ;
-		foreach ($sections as $section => $options) {
-			if (!isset (self::$instance->settings[$section]))
-				continue ;
-			foreach ($options as $var => $value) {
-				if (!isset (self::$instance->settings[$section][$var]))
-					continue ;
-				self::$instance->settings[$section][$var] = $value ;
+		if (file_exists($file)) {
+			$sections = parse_ini_file ($file, true) ;
+			if(is_array($is)) {
+				foreach ($sections as $section => $options) {
+					if (!isset (self::$instance->settings[$section]))
+						continue ;
+					foreach ($options as $var => $value) {
+						if (!isset (self::$instance->settings[$section][$var]))
+							continue ;
+						self::$instance->settings[$section][$var] = $value ;
+					}
+				}
 			}
 		}
 		return ;




More information about the Fusionforge-commits mailing list