Revert "merged branch stealth35/ini_bool (PR #2235)"
This reverts commit363057b181
, reversing changes made to545cd4cd63
.
This commit is contained in:
parent
fa13469bba
commit
49c585ebd2
@ -35,18 +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) {
|
||||
switch (strtolower($value)) {
|
||||
case 'true' : $value = true ; break;
|
||||
case 'false': $value = false; break;
|
||||
case 'null' : $value = null ; break;
|
||||
}
|
||||
$this->container->setParameter($key, $value);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
[parameters]
|
||||
foo = true
|
||||
bar = False
|
||||
boo = NULL
|
@ -35,11 +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('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');
|
||||
|
Reference in New Issue
Block a user