8000 [DI] align IniFileLoader to PHP bugfix #76965 by nicolas-grekas · Pull Request #29165 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public function supports($resource, $type = null)
private function phpize($value)
{
// 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);

switch (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
constant = PHP_VERSION
12 = 12
12_string = '12'
12_quoted_number = "12"
12_comment = 12 ; comment
12_string_comment = '12' ; comment
12_string_comment_again = "12" ; comment
12_quoted_number_comment = "12" ; comment
-12 = -12
0 = 0
1 = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public function testTypeConversionsWithNativePhp($key, $value, $supported)
$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);
$this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types');
}
Expand All @@ -78,9 +77,10 @@ public function getTypeConversions()
array('constant', PHP_VERSION, true),
array('12', 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_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('1', 1, true),
array('0', 0, true),
Expand Down
0