xref: /PHP-7.0/ext/opcache/tests/issue0115.phpt (revision 19b757da)
1--TEST--
2ISSUE #115 (path issue when using phar)
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
14Phar::interceptFileFuncs();
15require "phar://this/index.php";
16__HALT_COMPILER(); ?>';
17$p = new Phar(__DIR__ . '/issue0115_1.phar.php', 0, 'this');
18$p['index.php'] = '<?php
19  echo "Hello from Index 1.\n";
20  require_once "phar://this/hello.php";
21';
22$p['hello.php'] = "Hello World 1!\n";
23$p->setStub($stub);
24unset($p);
25$p = new Phar(__DIR__ . '/issue0115_2.phar.php', 0, 'this');
26$p['index.php'] = '<?php
27  echo "Hello from Index 2.\n";
28  require_once "phar://this/hello.php";
29';
30$p['hello.php'] = "Hello World 2!\n";
31$p->setStub($stub);
32unset($p);
33
34include "php_cli_server.inc";
35php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d extension=phar.'.PHP_SHLIB_SUFFIX);
36echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php');
37echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php');
38?>
39--CLEAN--
40<?php
41@unlink(__DIR__ . '/issue0115_1.phar.php');
42@unlink(__DIR__ . '/issue0115_2.phar.php');
43?>
44--EXPECT--
45Hello from Index 1.
46Hello World 1!
47Hello from Index 2.
48Hello World 2!
49