#41985 [Bgs->Opn]: rename doesn't work
| From: | marc dot bau at gmx dot net | Date: | Fri, 13 Jul 2007 20:36:36 +0000 |
| Subject: | #41985 [Bgs->Opn]: rename doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115045@lists.php.net to get a copy of this message | ||
ID: 41985
User updated by: marc dot bau at gmx dot net
Reported By: marc dot bau at gmx dot net
-Status: Bogus
+Status: Open
Bug Type: Filesystem function related
Operating System: Windows
PHP Version: 5.2.3
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-07-13 18:44:15] tony2001@php.net
Please escape the \ as advised in the manual.
------------------------------------------------------------------------
[2007-07-13 18:33:37] marc dot bau at gmx dot net
This doesn't have anything to do with double quotes. With single quotes
this isn't working, too.
<?php
rename('C:\temp\tmp_file.txt.new', 'C:\temp\tmp_file.txt');
?>
------------------------------------------------------------------------
[2007-07-13 09:30:47] tony2001@php.net
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
------------------------------------------------------------------------
[2007-07-13 06:12:45] marc dot bau at gmx dot net
What are you talking about? Writing write code once, run everywhere?
This is currently not possible and therefor this is for sure a bug.
Rename is not working the same way on all OS'es and this is why i filed
this bug. I don't like to workaround in a shit way like described in
http://us.php.net/manual/en/function.rename.php#56576.
This one produces
a PHP error that is logged in my CMS.
So let's fix this to make PHP work in the same way on all OS without
dirty hacks. You may fix this in the way of #56576 PHP *internally*, but
don't make me to hack around outside and create crappy code around.
------------------------------------------------------------------------
[2007-07-12 22:50:59] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
\\t has a special meaning in strings with double quotes.
------------------------------------------------------------------------
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