Skip to content

Commit 4152e36

Browse files
committed
fix more numeric cases changing in PHP 8
1 parent 968ffcf commit 4152e36

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Inline.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public static function dump($value, $flags = 0)
210210
return 'false';
211211
case ctype_digit($value):
212212
return \is_string($value) ? "'$value'" : (int) $value;
213-
case is_numeric($value) && false === strpos($value, "\n"):
213+
case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
214214
$locale = setlocale(LC_NUMERIC, 0);
215215
if (false !== $locale) {
216216
setlocale(LC_NUMERIC, 'C');

Tests/InlineTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,14 @@ public function getTestsForDump()
570570
['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']],
571571

572572
['{ foo: { bar: { 1: 2, baz: 3 } } }', ['foo' => ['bar' => [1 => 2, 'baz' => 3]]]],
573+
574+
// numeric strings with trailing whitespaces
575+
["'0123 '", '0123 '],
576+
['"0123\f"', "0123\f"],
577+
['"0123\n"', "0123\n"],
578+
['"0123\r"', "0123\r"],
579+
['"0123\t"', "0123\t"],
580+
['"0123\v"', "0123\v"],
573581
];
574582
}
575583

0 commit comments

Comments
 (0)