소스 검색

fixed writing of ini values

Fabien Potencier 14 년 전
부모
커밋
e6ba06d76a
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      Configurator.php

+ 9 - 0
Configurator.php

@@ -107,6 +107,15 @@ class Configurator
         $lines[] = "[parameters]\n";
 
         foreach ($this->parameters as $key => $value) {
+            if (is_integer($value) || is_float($value)) {
+            } elseif (is_bool($value)) {
+                $value = $value ? 'true' : 'false';
+            } elseif (false === strpos($value, '"')) {
+                $value = '"'.$value.'"';
+            } else {
+                throw new \RuntimeException('A value in an ini file can not contain double quotes (").');
+            }
+
             $lines[] = sprintf("    %s=%s\n", $key, $value);
         }