xref: /PHP-5.6/ext/phar/tests/bug47085.phpt (revision fd5be66d)
1--TEST--
2Phar: PHP bug #47085: "rename() returns true even if the file in PHAR does not exist"
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$fname = dirname(__FILE__) . '/' . 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===DONE===
19--CLEAN--
20<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');?>
21--EXPECTF--
22Warning: 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
23bool(false)
24===DONE===