ID: 41985 User updated by: marc dot bau at gmx dot net Reported By: marc dot bau at gmx dot net Status: Open Bug Type: Feature/Change Request Operating System: Windows PHP Version: 5.2.3 New Comment:
Well, if this rename is not possible atomically (how bad this ever is), i think PHP should handle the copy/unlink logic in background if i use "rename()". I simply don't like to think about possible platform dependencies (i don't know anything about) and hack around in a bad way that additional produce an error with "E_ALL & ~E_NOTICE" i cannot circumvent. Previous Comments: ------------------------------------------------------------------------ [2007-07-14 10:35:16] [EMAIL PROTECTED] I actually agree with that... however, it's not possible to do this atomically on windows if the file you're moving to exists. The only option is to unlink() the target and then do the rename() but that leaves a race condition. I don't think that is solvable on Windows. ------------------------------------------------------------------------ [2007-07-13 20:57:49] marc dot bau at gmx dot net Do you know how this works on *nix systems? Well i will tell you - it will *move* the "new file" over the "old file" in an atomic rename. This is what PHP needs to handle on Windows, too. I don't need any extras on *nix to rename. And PHP internal command should work platform independent. This bug should be fixed to make sure the code runs on windows in the *same way* as it does on *nix systems. What is so difficult to understand about this? Writing write code once, *run everywhere* is not possible with this bug. ------------------------------------------------------------------------ [2007-07-13 20:48:09] [EMAIL PROTECTED] Please open a dictionary and translate the error message: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): ****File exists**** in C:\Temp\rename-test.php on line 2 It says FILE EXISTS, don't you see it? Please do NOT reopen the report again. Thank you. ------------------------------------------------------------------------ [2007-07-13 20:36:36] marc dot bau at gmx dot net As already said, this won't help anything. DON'T WORK: <?php rename('C:\temp\tmp_file.txt.new', 'C:\temp\tmp_file.txt'); ?> Error: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 DON'T WORK: <?php rename('C:\\temp\\tmp_file.txt.new', 'C:\\temp\\tmp_file.txt'); ?> Error: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 DON'T WORK: <?php rename("C:\\temp\\tmp_file.txt.new", "C:\\temp\\tmp_file.txt"); ?> Error: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 DON'T WORK: <?php rename("C:/temp/tmp_file.txt.new", "C:/temp/tmp_file.txt"); ?> Error: PHP Warning: rename(C:/temp/tmp_file.txt.new,C:/temp/tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 So you have a Windows Box next to you? Before answering, test yourself if you don't trust me, but don't close this case until this bug has been fixed! THX. ------------------------------------------------------------------------ [2007-07-13 18:44:15] [EMAIL PROTECTED] Please escape the \ as advised in the manual. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41985 -- Edit this bug report at http://bugs.php.net/?id=41985&edit=1