|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-11-09 18:39 UTC] anon at anon dot anon
[2012-11-12 01:56 UTC] aharvey@php.net
[2012-11-12 01:56 UTC] aharvey@php.net
-Status: Open
+Status: Assigned
-Type: Bug
+Type: Documentation Problem
-Package: Filesystem function related
+Package: Documentation problem
-Assigned To:
+Assigned To: aharvey
[2012-11-12 02:00 UTC] aharvey@php.net
[2012-11-12 02:00 UTC] aharvey@php.net
-Status: Assigned
+Status: Closed
[2012-11-12 02:00 UTC] aharvey@php.net
[2012-11-13 06:56 UTC] anon at anon dot anon
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Mar 20 23:00:02 2026 UTC |
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