1--TEST--
2Phar: phar:// include with Opcache
3--SKIPIF--
4<?php if (strpos(PHP_OS, 'WIN') === false) die("skip Extra warning on Windows."); ?>
5<?php if (!extension_loaded("phar")) die("skip"); ?>
6<?php if (!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not available'); ?>
7<?php
8    $cache_dir = dirname(__FILE__) . "/024-file_cache";
9    if (!is_dir($cache_dir) && !mkdir($cache_dir)) die("skip unable to create file_cache dir");
10?>
11--INI--
12phar.require_hash=0
13opcache.enable=1
14opcache.enable_cli=1
15opcache.file_cache={PWD}/024-file_cache
16opcache.memory_consumption=64
17opcache.interned_strings_buffer=8
18opcache.max_accelerated_files=4000
19opcache.jit_buffer_size=6M
20opcache.revalidate_freq=60
21opcache.fast_shutdown=1
22--FILE--
23<?php
24
25$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
26$pname = 'phar://' . $fname;
27$file = "<?php __HALT_COMPILER(); ?>";
28
29$files = array();
30$files['a.php'] = '<?php echo "This is a\n"; ?>';
31$files['b.php'] = '<?php echo "This is b\n"; ?>';
32$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
33
34include 'files/phar_test.inc';
35
36include $pname . '/a.php';
37include $pname . '/b.php';
38include $pname . '/b/c.php';
39
40$cache_dir = ini_get("opcache.file_cache");
41if (is_dir($cache_dir)) {
42    $it = new RecursiveIteratorIterator(
43        new RecursiveDirectoryIterator($cache_dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST
44    );
45    foreach ($it as $fi) {
46        $fn = ($fi->isDir() ? 'rmdir' : 'unlink');
47        $fn($fi->getRealPath());
48    }
49
50    rmdir($cache_dir);
51}
52
53?>
54--CLEAN--
55<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
56--EXPECT--
57This is a
58This is b
59This is b/c
60