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