1--TEST--
2Phar: delete a file within a zip-based .phar (confirm disk file is changed)
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8opcache.validate_timestamps=1
9--FILE--
10<?php
11
12$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
13$alias = 'phar://' . $fname;
14
15$phar = new Phar($fname);
16$phar['a.php'] = '<?php echo "This is a\n"; ?>';
17$phar['b.php'] = '<?php echo "This is b\n"; ?>';
18$phar['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
19$phar->setStub('<?php __HALT_COMPILER(); ?>');
20$phar->stopBuffering();
21
22include $alias . '/a.php';
23include $alias . '/b.php';
24include $alias . '/b/c.php';
25
26$md5 = md5_file($fname);
27unlink($alias . '/b/c.php');
28clearstatcache();
29$md52 = md5_file($fname);
30if ($md5 == $md52) echo 'file was not modified';
31?>
32===AFTER===
33<?php
34include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/a.php';
35include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/b.php';
36include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/b/c.php';
37?>
38
39--CLEAN--
40<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
41--EXPECTF--
42This is a
43This is b
44This is b/c
45===AFTER===
46This is a
47This is b
48
49Warning: include(%sdelete_in_phar_confirm.phar.zip/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.zip" in %sdelete_in_phar_confirm.php on line %d
50
51Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.zip/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
52
53