#44870 [NEW]: rename() on directory deletes same named file
From: ant@php.net
Operating system: Windows/XP
PHP version: 5.3CVS-2008-04-30 (snap)
PHP Bug Type: Streams related
Bug description: rename() on directory deletes same named file
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 bug report at http://bugs.php.net/?id=44870&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44870&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44870&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44870&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44870&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44870&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44870&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44870&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44870&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44870&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44870&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44870&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44870&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44870&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44870&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44870&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44870&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44870&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44870&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44870&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44870&r=mysqlcfg
Thread (6 messages)
- ant@php.net