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