Bug #63473 [NEW]: rename rename

From: Date: Fri, 09 Nov 2012 18:32:42 +0000
Subject: Bug #63473 [NEW]: rename rename
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174604@lists.php.net to get a copy of this message
From: anon at anon dot anon Operating system: PHP version: 5.4.8 Package: Filesystem function related Bug Type: Bug Bug description:rename rename Description: ------------ The rename function overwrites. This is totally unexpected and unintuitive behavior which could cause data loss, and it is not even documented. Combined with the fact that the rename function can "rename" across drives, it's obviously a move, not a rename. Then it should be called move, so you can tell what it does. Test script: --------------- <?php file_put_contents('1.txt', 'one'); file_put_contents('2.txt', 'two'); rename('2.txt', '1.txt'); echo '1.txt:' . file_get_contents('1.txt'); echo '2.txt:' . file_get_contents('2.txt'); Expected result: ---------------- 1.txt:one 2.txt:two plus an error that the name exists Actual result: -------------- 1.txt:two 2.txt: plus an error that 2.txt does not exist -- Edit bug report at https://bugs.php.net/bug.php?id=63473&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63473&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63473&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63473&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63473&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63473&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63473&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63473&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63473&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63473&r=support Expected behavior: https://bugs.php.net/fix.php?id=63473&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63473&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63473&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63473&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63473&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63473&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63473&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63473&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63473&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63473&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63473&r=mysqlcfg

« previous php.bugs (#174604) next »