Number Casting allow preceding space (#14699)

This commit is contained in:
Tony Murray
2022-12-15 16:01:01 -06:00
committed by GitHub
parent 88c86f2a19
commit e84b2c0c75
+1 -1
View File
@@ -97,7 +97,7 @@ class Number
{
if (! is_numeric($number)) {
// match pre-PHP8 behavior
if (! preg_match('/^-?\d+(\.\d+)?/', $number ?? '', $matches)) {
if (! preg_match('/^\s*-?\d+(\.\d+)?/', $number ?? '', $matches)) {
return 0;
}
$number = $matches[0];