ID: 32160
Updated by: [EMAIL PROTECTED]
Reported By: chernyshevsky at hotmail dot com
-Status: Open
+Status: Verified
Bug Type: Filesystem function related
-Operating System: Win32/Linux
+Operating System: *
-PHP Version: 4.3.10
+PHP Version: 4CVS, 5CVS (2005-02-02)
Previous Comments:
------------------------------------------------------------------------
[2005-03-02 03:20:26] chernyshevsky at hotmail dot com
Description:
------------
Copying a file into itself causes the source file to be truncate to 0
bytes.
copy("test", "test"); // test.txt -> 0
You can't avoid this problem just by comparing the filenames, since one
could be a symlink pointing to the other. The following would destroy
test1 if test2 is a link to test1:
copy("test1", "test2");
Reproduce code:
---------------
copy("test", "test");
Expected result:
----------------
Nothing happens or a file open error.
Actual result:
--------------
Contents in source file is lost.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32160&edit=1