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

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




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

[2008-05-02 14:09:14] [EMAIL PROTECTED]

The patch to fix this special case:

http://blog.thepimp.net/patches/bug44870.patch.txt

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

[2008-05-02 14:08:53] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



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

[2008-04-30 14:40:16] [EMAIL PROTECTED]

On Unix:
Renaming a file to a file that already exists overwrites it.
Renaming a file to a directory that already exists does not write, and
throws an error.

Windows should obviously behave the same.

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

[2008-04-30 14:17:25] [EMAIL PROTECTED]

"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).

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

[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