xref: /PHP-8.3/ext/pcre/tests/bug72685.phpt (revision 54dd762f)
1--TEST--
2Bug #72685: Same string is UTF-8 validated repeatedly
3--SKIPIF--
4<?php
5if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
6?>
7--FILE--
8<?php
9
10$input_size = 64 * 1024;
11$str = str_repeat('a', $input_size);
12
13$start = microtime(true);
14$pos = 0;
15while (preg_match('/\G\w/u', $str, $m, 0, $pos)) ++$pos;
16$end = microtime(true);
17var_dump(($end - $start) < 0.5); // large margin, more like 0.05 in debug build
18
19?>
20--EXPECT--
21bool(true)
22