Req #41985 [Opn->Csd]: rename doesn't work
| From: | pajoye@php.net | Date: | Wed, 20 Mar 2013 20:13:19 +0000 |
| Subject: | Req #41985 [Opn->Csd]: rename doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177936@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=41985&edit=1
ID: 41985
Updated by: pajoye@php.net
Reported by: marc dot bau at gmx dot net
Summary: rename doesn't work
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Windows
PHP Version: 5.2.3
-Assigned To:
+Assigned To: pajoye
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2013-03-20 19:34:07] cmbecker69 at gmx dot de
This issue is solved since PHP 5.3.0 (released 2009-06-30).
rename() works atomic on Windows due to the use of
MoveFileEx(..., ..., MOVEFILE_REPLACE_EXISTING)
(see virtual_rename() in TSRM/tsrm_virtual_cwd.c
resp. VCWD_RENAME() in TSRM/tsrm_virtual.cwd.h).
So this issue can be closed.
------------------------------------------------------------------------
[2009-12-08 06:10:18] rainmanhhh at tom dot com
rename should be remake to copy + unlink to keep php do the same behavior on windows & *nix
------------------------------------------------------------------------
[2007-07-14 12:58:22] marc dot bau at gmx dot net
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.
------------------------------------------------------------------------
[2007-07-14 10:35:16] derick@php.net
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.
------------------------------------------------------------------------
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
https://bugs.php.net/bug.php?id=41985
--
Edit this bug report at https://bugs.php.net/bug.php?id=41985&edit=1