xref: /PHP-8.2/ext/phar/tests/zip/rename_dir.phpt (revision 74859783)
1--TEST--
2Phar: rename_dir test zip-based
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10
11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
12$alias = 'phar://' . $fname;
13
14$phar = new Phar($fname);
15$phar->setStub("<?php
16Phar::mapPhar('hio');
17__HALT_COMPILER(); ?>");
18$phar['a/x'] = 'a';
19$phar->stopBuffering();
20
21include $fname;
22
23echo file_get_contents($alias . '/a/x') . "\n";
24rename($alias . '/a', $alias . '/b');
25echo file_get_contents($alias . '/b/x') . "\n";
26echo file_get_contents($alias . '/a/x') . "\n";
27?>
28--CLEAN--
29<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
30--EXPECTF--
31a
32a
33
34Warning: file_get_contents(phar://%srename_dir.phar.zip/a/x): Failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.zip" in %srename_dir.php on line %d
35