xref: /PHP-8.4/ext/phar/tests/zip/rename.phpt (revision 74859783)
1--TEST--
2Phar: rename 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'] = 'a';
19$phar->stopBuffering();
20
21include $fname;
22
23echo file_get_contents($alias . '/a') . "\n";
24rename($alias . '/a', $alias . '/b');
25echo file_get_contents($alias . '/b') . "\n";
26echo file_get_contents($alias . '/a') . "\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.phar.zip/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.zip" in %srename.php on line %d
35