Quote values in .ini file
[shpub.git] / src / shpub / Config.php
index 352ab99da68b8194b865e841fa2486a338762e70..d41e45dc2a3495179fb797eb185d471a0b8e015f 100644 (file)
@@ -65,7 +65,8 @@ class Config
                 if ($hostVal == '') {
                     continue;
                 }
-                $str .= $hostProp . '=' . $hostVal . "\n";
+                $str .= $hostProp
+                    . '=' . static::quoteIniValue($hostVal) . "\n";
             }
         }
         $cfgFilePath = $this->getConfigFilePath();
@@ -105,5 +106,13 @@ class Config
         }
         return null;
     }
+
+    public static function quoteIniValue($val)
+    {
+        if (strpos($val, '=') === false) {
+            return $val;
+        }
+        return '"' . $val . '"';
+    }
 }
 ?>