xref: /PHP-7.2/ext/pcre/tests/cache_limit.phpt (revision 5be8872f)
1--TEST--
2Compiled regex cache limit
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6?>
7--FILE--
8<?php
9define('PREG_CACHE_SIZE', 4096+1);
10
11$re = '';
12$str = str_repeat('x', PREG_CACHE_SIZE);
13
14for ($i=0; $i < PREG_CACHE_SIZE; ++$i) {
15	$re .= '.';
16	if (!preg_match("/$re/", $str)) {
17		die('non match. error');
18	}
19}
20
21var_dump(preg_match('/./', $str));   // this one was already deleted from the cache
22var_dump(preg_match("/$re/", $str)); // but not this one
23
24echo "done\n";
25?>
26--EXPECT--
27int(1)
28int(1)
29done
30