#41985 [Opn->Bgs]: rename doesn't work

From: Date: Fri, 13 Jul 2007 20:48:09 +0000
Subject: #41985 [Opn->Bgs]: rename doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115046@lists.php.net to get a copy of this message
ID: 41985 Updated by: tony2001@php.net Reported By: marc dot bau at gmx dot net -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Windows PHP Version: 5.2.3 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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] 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. ------------------------------------------------------------------------ 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

« previous php.bugs (#115046) next »