xref: /PHP-7.2/ext/opcache/tests/issue0149.phpt (revision 19b757da)
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--SKIPIF--
8<?php require_once('skipif.inc'); ?>
9<?php if (!extension_loaded("phar")) die("skip"); ?>
10<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
11--FILE--
12<?php
13$stub = "<?php header('Content-Type: text/plain;');
14Phar::mount('this.file', '". __FILE__ . "');
15echo 'OK\n';
16__HALT_COMPILER(); ?>";
17$p = new Phar(__DIR__ . '/issue0149.phar.php', 0, 'this');
18$p['index.php'] = "";  # A Phar must have at least one file, hence this dummy
19$p->setStub($stub);
20unset($p);
21
22include "php_cli_server.inc";
23php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d extension=phar.'.PHP_SHLIB_SUFFIX);
24echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
25echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
26echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');
27?>
28--CLEAN--
29<?php
30@unlink(__DIR__ . '/issue0149.phar.php');
31?>
32--EXPECT--
33OK
34OK
35OK
36