xref: /PHP-8.1/ext/phar/tests/bug47085.phpt (revision 74859783)
1--TEST--
2Phar: PHP bug #47085: "rename() returns true even if the file in PHAR does not exist"
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar';
11
12$phar = new Phar($fname, 0, 'a.phar');
13$phar['x'] = 'hi';
14unset($phar);
15rename("phar://a.phar/x", "phar://a.phar/y");
16var_dump(rename("phar://a.phar/x", "phar://a.phar/y"));
17?>
18--CLEAN--
19<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');?>
20--EXPECTF--
21Warning: rename(): phar error: cannot rename "phar://a.phar/x" to "phar://a.phar/y" from extracted phar archive, source does not exist in %sbug47085.php on line %d
22bool(false)
23