Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  Backport: Improve link script with rollback when using symlink
  fix more numeric cases changing in PHP 8
  • Loading branch information
fabpot committed Aug 26, 2020
2 parents 726cb33 + e2a6952 commit a44bd3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static function dump($value, int $flags = 0): string
return 'false';
case ctype_digit($value):
return \is_string($value) ? "'$value'" : (int) $value;
case is_numeric($value) && false === strpos($value, "\n"):
case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
$locale = setlocale(LC_NUMERIC, 0);
if (false !== $locale) {
setlocale(LC_NUMERIC, 'C');
Expand Down
8 changes: 8 additions & 0 deletions Tests/InlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,14 @@ public function getTestsForDump()
['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']],

['{ foo: { bar: { 1: 2, baz: 3 } } }', ['foo' => ['bar' => [1 => 2, 'baz' => 3]]]],

// numeric strings with trailing whitespaces
["'0123 '", '0123 '],
['"0123\f"', "0123\f"],
['"0123\n"', "0123\n"],
['"0123\r"', "0123\r"],
['"0123\t"', "0123\t"],
['"0123\v"', "0123\v"],
];
}

Expand Down

0 comments on commit a44bd3a

Please sign in to comment.