bug74596.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --TEST--
  2. Bug #74596 (SIGSEGV with opcache.revalidate_path enabled)
  3. --INI--
  4. opcache.enable=1
  5. opcache.enable_cli=1
  6. opcache.file_update_protection=0
  7. opcache.validate_timestamps=0
  8. opcache.file_cache_only=0
  9. opcache.revalidate_path=1
  10. --EXTENSIONS--
  11. opcache
  12. --FILE--
  13. <?php
  14. file_put_contents(__DIR__ . "/bug74596_1.php", <<<CODE
  15. <?php
  16. class A {
  17. public function __construct() {
  18. \$a = true;
  19. if (\$a) {
  20. echo 1 + 2;
  21. } else {
  22. echo 2 + 3;
  23. }
  24. }
  25. }
  26. ?>
  27. CODE
  28. );
  29. file_put_contents(__DIR__ . "/bug74596_2.php", "ok\n");
  30. class ufilter extends php_user_filter
  31. {
  32. function filter($in, $out, &$consumed, $closing): int
  33. {
  34. include_once __DIR__ . "/bug74596_1.php";
  35. while ($bucket = stream_bucket_make_writeable($in)) {
  36. stream_bucket_append($out, $bucket);
  37. }
  38. return PSFS_PASS_ON;
  39. }
  40. }
  41. stream_filter_register("ufilter", "ufilter");
  42. include "php://filter/read=ufilter/resource=" . __DIR__ . "/bug74596_2.php";
  43. ?>
  44. --CLEAN--
  45. <?php
  46. unlink(__DIR__ . "/bug74596_1.php");
  47. unlink(__DIR__ . "/bug74596_2.php");
  48. ?>
  49. --EXPECT--
  50. ok