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