cache_limit.phpt 540 B

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