xref: /PHP-8.1/ext/opcache/tests/bug65915.phpt (revision e9f783fc)
1--TEST--
2Bug #65915 (Inconsistent results with require return value)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_cache_only=0
7--EXTENSIONS--
8opcache
9--SKIPIF--
10<?php
11// We don't invalidate the file after the second write.
12if (getenv('SKIP_REPEAT')) die("skip Not repeatable");
13?>
14--FILE--
15<?php
16$tmp = __DIR__ . "/bug65915.inc.php";
17
18file_put_contents($tmp, '<?php return function(){ return "a";};');
19$f = require $tmp;
20var_dump($f());
21
22var_dump(opcache_invalidate($tmp, true));
23
24file_put_contents($tmp, '<?php return function(){ return "b";};');
25$f = require $tmp;
26var_dump($f());
27
28@unlink($tmp);
29?>
30--EXPECT--
31string(1) "a"
32bool(true)
33string(1) "b"
34