[DI] align IniFileLoader to PHP bugfix #76965
This commit is contained in:
parent
5916bbe743
commit
0ab87f44e6
@ -70,7 +70,9 @@ class IniFileLoader extends FileLoader
|
|||||||
private function phpize($value)
|
private function phpize($value)
|
||||||
{
|
{
|
||||||
// trim on the right as comments removal keep whitespaces
|
// trim on the right as comments removal keep whitespaces
|
||||||
$value = rtrim($value);
|
if ($value !== $v = rtrim($value)) {
|
||||||
|
$value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v;
|
||||||
|
}
|
||||||
$lowercaseValue = strtolower($value);
|
$lowercaseValue = strtolower($value);
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
@ -11,9 +11,10 @@
|
|||||||
constant = PHP_VERSION
|
constant = PHP_VERSION
|
||||||
12 = 12
|
12 = 12
|
||||||
12_string = '12'
|
12_string = '12'
|
||||||
|
12_quoted_number = "12"
|
||||||
12_comment = 12 ; comment
|
12_comment = 12 ; comment
|
||||||
12_string_comment = '12' ; comment
|
12_string_comment = '12' ; comment
|
||||||
12_string_comment_again = "12" ; comment
|
12_quoted_number_comment = "12" ; comment
|
||||||
-12 = -12
|
-12 = -12
|
||||||
0 = 0
|
0 = 0
|
||||||
1 = 1
|
1 = 1
|
||||||
|
@ -58,7 +58,6 @@ class IniFileLoaderTest extends TestCase
|
|||||||
$this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value));
|
$this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->loader->load('types.ini');
|
|
||||||
$expected = parse_ini_file(__DIR__.'/../Fixtures/ini/types.ini', true, INI_SCANNER_TYPED);
|
$expected = parse_ini_file(__DIR__.'/../Fixtures/ini/types.ini', true, INI_SCANNER_TYPED);
|
||||||
$this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types');
|
$this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types');
|
||||||
}
|
}
|
||||||
@ -78,9 +77,10 @@ class IniFileLoaderTest extends TestCase
|
|||||||
array('constant', PHP_VERSION, true),
|
array('constant', PHP_VERSION, true),
|
||||||
array('12', 12, true),
|
array('12', 12, true),
|
||||||
array('12_string', '12', true),
|
array('12_string', '12', true),
|
||||||
|
array('12_quoted_number', 12, false), // INI_SCANNER_RAW removes the double quotes
|
||||||
array('12_comment', 12, true),
|
array('12_comment', 12, true),
|
||||||
array('12_string_comment', '12', true),
|
array('12_string_comment', '12', true),
|
||||||
array('12_string_comment_again', '12', true),
|
array('12_quoted_number_comment', 12, false), // INI_SCANNER_RAW removes the double quotes
|
||||||
array('-12', -12, true),
|
array('-12', -12, true),
|
||||||
array('1', 1, true),
|
array('1', 1, true),
|
||||||
array('0', 0, true),
|
array('0', 0, true),
|
||||||
|
Reference in New Issue
Block a user