ID:               44870
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         Streams related
 Operating System: Windows/XP
 PHP Version:      5.3CVS-2008-04-30 (snap)
-Assigned To:      
+Assigned To:      pajoye
 New Comment:

"Calling rename() on a directory where there is already a file with
the
new name does something odd, it renames the directory but also deletes
the file."

Can you test it with 5.2.x please?

I know that rename on windows will not rename a file when a directory
already exists with the same (new) name. I'm not sure about renaming a
directory.

But the general idea is to replace a file if it is named using the new
name (all platforms).


Previous Comments:
------------------------------------------------------------------------

[2008-04-30 14:09:56] [EMAIL PROTECTED]

Description:
------------
Calling rename() on a directory where there is already a file with the
new name does something odd, it renames the directory but also deletes
the file.

If this is in fact a bug then the test case rename_variation3.phpt will
need to be fixed up.

Reproduce code:
---------------
<?php

$file_path = dirname(__FILE__);
$filename = "$file_path/rename_variation3.tmp"; 
$dirname = "$file_path/rename_variation3_dir"; 

mkdir($dirname);

$fp = fopen($filename, "w");
fclose($fp);
var_dump( rename($dirname, $filename) );

echo "Done\n";
?>


Expected result:
----------------
A directory called rename_variation3.tmp and also a file called
rename_variation3.tmp

Actual result:
--------------
A directory called rename_variation3.tmp and no file..!


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44870&edit=1

Reply via email to