merged 2.0

This commit is contained in:
Fabien Potencier 2011-09-25 11:52:31 +02:00
commit 1103ca8185
5 changed files with 5 additions and 27 deletions

View File

@ -7,6 +7,10 @@ in 2.0 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.0.0...v2.0.1
* 2.0.3 (2011-09-25)
* 49c585e: Revert "merged branch stealth35/ini_bool (PR #2235)"
* 2.0.2 (2011-09-25)
* ae3aded: Added PCRE_DOTALL modifier to RouteCompiler to allow urlencoded linefeed in route parameters.

View File

@ -35,20 +35,13 @@ class IniFileLoader extends FileLoader
$this->container->addResource(new FileResource($path));
$result = parse_ini_file($path, true, INI_SCANNER_RAW);
$result = parse_ini_file($path, true);
if (false === $result || array() === $result) {
throw new \InvalidArgumentException(sprintf('The "%s" file is not valid.', $file));
}
if (isset($result['parameters']) && is_array($result['parameters'])) {
foreach ($result['parameters'] as $key => $value) {
if (!is_array($value)) {
switch (strtolower($value)) {
case 'true' : $value = true ; break;
case 'false': $value = false; break;
case 'null' : $value = null ; break;
}
}
$this->container->setParameter($key, $value);
}
}

View File

@ -1,5 +0,0 @@
[parameters]
foo = bar
versions[] = "1"
versions[] = "2"
versions[] = "3"

View File

@ -1,4 +0,0 @@
[parameters]
foo = true
bar = False
boo = NULL

View File

@ -35,16 +35,6 @@ class IniFileLoaderTest extends \PHPUnit_Framework_TestCase
$loader->load('parameters.ini');
$this->assertEquals(array('foo' => 'bar', 'bar' => '%foo%'), $container->getParameterBag()->all(), '->load() takes a single file name as its first argument');
$container = new ContainerBuilder();
$loader = new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini'));
$loader->load('array.ini');
$this->assertEquals(array('foo' => 'bar', 'versions' => array(1, 2, 3)), $container->getParameterBag()->all(), '->load() takes a single file name as its first argument');
$container = new ContainerBuilder();
$loader = new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini'));
$loader->load('boolean.ini');
$this->assertEquals(array('foo' => true, 'bar' => false, 'boo' => null), $container->getParameterBag()->all());
try {
$loader->load('foo.ini');
$this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist');