Skip to content

Commit 6cd5bd1

Browse files
authoredJul 10, 2022
Fix "%f" regex in run-tests.php (#8965)
"-.0.0" and "0." is no longer matched wrongly
1 parent d217a66 commit 6cd5bd1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎run-tests.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -2583,10 +2583,9 @@ function run_test(string $php, $file, array $env): string
25832583
$wanted_re = str_replace('%i', '[+-]?\d+', $wanted_re);
25842584
$wanted_re = str_replace('%d', '\d+', $wanted_re);
25852585
$wanted_re = str_replace('%x', '[0-9a-fA-F]+', $wanted_re);
2586-
$wanted_re = str_replace('%f', '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', $wanted_re);
2586+
$wanted_re = str_replace('%f', '[+-]?(?:\d+|(?=\.\d))(?:\.\d+)?(?:[Ee][+-]?\d+)?', $wanted_re);
25872587
$wanted_re = str_replace('%c', '.', $wanted_re);
25882588
$wanted_re = str_replace('%0', '\x00', $wanted_re);
2589-
// %f allows two points "-.0.0" but that is the best *simple* expression
25902589
}
25912590

25922591
if (preg_match("/^$wanted_re\$/s", $output)) {

0 commit comments

Comments
 (0)