revalidate_path_01.phpt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --TEST--
  2. revalidate_path 01: OPCache must cache only resolved real paths when revalidate_path is set
  3. --INI--
  4. opcache.enable=1
  5. opcache.enable_cli=1
  6. opcache.revalidate_path=1
  7. --SKIPIF--
  8. <?php require_once('skipif.inc'); ?>
  9. <?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
  10. --FILE--
  11. <?php
  12. $dir = dirname(__FILE__);
  13. $dir1 = "$dir/test1";
  14. $dir2 = "$dir/test2";
  15. $link = "$dir/test";
  16. $file1 = "$dir1/index.php";
  17. $file2 = "$dir2/index.php";
  18. $main = "$dir/main.php";
  19. @mkdir($dir1);
  20. @mkdir($dir2);
  21. @file_put_contents($main, '<?php include(\'' . $link .'/index.php\');');
  22. @file_put_contents($file1, "TEST 1\n");
  23. @file_put_contents($file2, "TEST 2\n");
  24. while (filemtime($file1) != filemtime($file2)) {
  25. touch($file1);
  26. touch($file2);
  27. }
  28. @unlink($link);
  29. @symlink($dir1, $link);
  30. include "php_cli_server.inc";
  31. //php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1');
  32. php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1 -d opcache.file_update_protection=0 -d realpath_cache_size=0');
  33. echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
  34. echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
  35. @unlink($link);
  36. @symlink($dir2, $link);
  37. echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
  38. echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
  39. ?>
  40. --CLEAN--
  41. <?php
  42. $dir = dirname(__FILE__);
  43. $dir1 = "$dir/test1";
  44. $dir2 = "$dir/test2";
  45. $link = "$dir/test";
  46. $file1 = "$dir1/index.php";
  47. $file2 = "$dir2/index.php";
  48. $main = "$dir/main.php";
  49. @unlink($main);
  50. @unlink($link);
  51. @unlink($file1);
  52. @unlink($file2);
  53. @rmdir($dir1);
  54. @rmdir($dir2);
  55. ?>
  56. --EXPECT--
  57. TEST 1
  58. TEST 1
  59. TEST 2
  60. TEST 2