xref: /PHP-8.4/ext/opcache/tests/issue0149.phpt (revision 326dc17b)
1--TEST--
2ISSUE #149 (Phar mount points not working this OPcache enabled)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6phar.readonly=0
7--EXTENSIONS--
8opcache
9phar
10--CONFLICTS--
11server
12--FILE--
13<?php
14$stub = "<?php header('Content-Type: text/plain;');
15Phar::mount('this.file', '". __FILE__ . "');
16echo 'OK\n';
17__HALT_COMPILER(); ?>";
18$p = new Phar(__DIR__ . '/issue0149.phar.php', 0, 'this');
19$p['index.php'] = "";  # A Phar must have at least one file, hence this dummy
20$p->setStub($stub);
21unset($p);
22
23include "php_cli_server.inc";
24
25$ini = '-d opcache.enable=1 -d opcache.enable_cli=1';
26if (file_exists(ini_get('extension_dir').'/phar.'.PHP_SHLIB_SUFFIX)) {
27    $ini .= ' -d extension=phar.'.PHP_SHLIB_SUFFIX;
28}
29php_cli_server_start($ini);
30
31echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
32echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
33echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
34?>
35--CLEAN--
36<?php
37@unlink(__DIR__ . '/issue0149.phar.php');
38?>
39--EXPECT--
40OK
41OK
42OK
43