Skip to content

Commit f19cc6e

Browse files
committed
PHP 8.0 > Fix is_numeric behavior with trailing empty char
Numeric strings ending with whitespace ("42 ") will now return true. Previously, false was return instead. Use same fix has main maintened Yaml lib : symfony/yaml@4152e36 + performance improvement symfony/yaml@2b5f2ae
1 parent a285e3d commit f19cc6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/yaml/sfYamlInline.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static public function dump($value)
9999
return 'false';
100100
case (is_string($value) && ctype_digit($value)):
101101
return is_string($value) ? "'$value'" : (int) $value;
102-
case is_numeric($value):
102+
case is_numeric($value) && false === strpbrk($value, "\f\n\r\t\v"):
103103
return is_infinite($value) ? str_ireplace('INF', '.Inf', (string) $value) : (is_string($value) ? "'$value'" : $value);
104104
case false !== strpos($value, "\n") || false !== strpos($value, "\r"):
105105
return sprintf('"%s"', str_replace(array('"', "\n", "\r"), array('\\"', '\n', '\r'), $value));

0 commit comments

Comments
 (0)