|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-07-19 15:06 UTC] zet at male dot ru
Description:
------------
When i copy file with function copy, like this
copy("C:\file.gif", "C:\file.gif"), file was break. His size is 0.
Reproduce code:
---------------
copy("C:\file.gif", "C:\file.gif");
Expected result:
----------------
IMHO file must stand without changes.
Actual result:
--------------
File changed. His size is 0.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
what happens if you do: copy("C:\\file.gif", "C:\\file.gif")How come no one is looking into this? It's reproducible on Linux as well. copy("test.txt", "test.txt") -> 0 bytes You can't avoid this problem just by checking the filename, since one could be a symlink pointing to the other. It would introduce platform dependency as well (case-insensitivity on Windows).Reproducible with Windows and Linux, looks like platform independant: copy("/tmp/sess_1151d8174614735db903faef81b4fae0","/tmp/sess_1151d8174614735db903faef81b4fae0"); Actual result: -------------- File changed to 0 bytes.