ID: 44805 Updated by: [EMAIL PROTECTED] Reported By: rasmus at mindplay dot dk -Status: Assigned +Status: Closed Bug Type: Filesystem function related Operating System: WindowsXP/DebianLinux PHP Version: 5.2.5 Assigned To: dmitry New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2008-04-23 14:21:35] [EMAIL PROTECTED] For the record here: http://blog.thepimp.net/patches/TSRM_windows_rename.patch.txt http://blog.thepimp.net/patches/bug44805.phpt It fixes this issue. Dmitry will commit it in the next couple of days. Assigned to Dmitry. ------------------------------------------------------------------------ [2008-04-23 07:36:25] [EMAIL PROTECTED] That's correct. We already uses MoveFileEx in ext/zip (prooving that it is well supported by the current php windows setup). Patch + tests will come shortly. ------------------------------------------------------------------------ [2008-04-23 06:57:32] rasmus at mindplay dot dk File rename with overwrite code for Windows here: http://rikkus.info/rename-with-overwrite-on-windows.html ------------------------------------------------------------------------ [2008-04-23 06:53:09] rasmus at mindplay dot dk Description: ------------ The behavior of rename() is inconsistent between Linux and Windows. On Linux, the rename() function is atomic - you can rename() one file over an existing file, and the replacement is atomic. On Windows, you cannot rename over an existing file. Reproduce code: --------------- <?php file_put_contents("file1.txt", "this is file 1"); file_put_contents("file2.txt", "this is file 2"); rename("file1.txt", "file2.txt"); echo "reading file 2: "; readfile("file2.txt"); ?> Expected result: ---------------- reading file 2: this is file 1 Actual result: -------------- On Linux: (CORRECT) reading file 2: this is file 1 On Windows: (INCORRECT) Warning: rename(file1.txt,file2.txt) [function.rename]: File exists in C:\Web3\test\rename\test.php on line 6 reading file 2: this is file 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44805&edit=1
