ID:               29257
 Comment by:       richard dot managh at gmail dot com
 Reported By:      zet at male dot ru
 Status:           No Feedback
 Bug Type:         *Directory/Filesystem functions
 Operating System: Windows XP SP1
 PHP Version:      4.3.7
 New Comment:

Same behaviour here, on winxp with php4 and debian with php5, seems
conceptually wrong, I would report the exact versions but it would seem
this behaviour is constant on every version. Where is the sanity in
truncating a file to 0 bytes if the code attempts to copy it over
itself? Should preferably check for equivalent filepaths and not
perform the copy function, or at least report a warning that the files
were the same, both command line copy and cp (win and linux) do that.


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

[2005-02-11 07:04:45] nasheet at hotmail dot com

Reproducible with Windows and Linux, looks like platform independant:

copy("/tmp/sess_1151d8174614735db903faef81b4fae0","/tmp/sess_1151d8174614735db903faef81b4fae0");

Actual result:
--------------
File changed to 0 bytes.

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

[2005-01-14 21:40:35] chernyshevsky at hotmail dot com

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

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

[2004-08-01 01:00:05] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

[2004-07-20 02:47:41] [EMAIL PROTECTED]

what happens if you do: 
copy("C:\\file.gif", "C:\\file.gif") 

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

[2004-07-19 15:06:24] 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.


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


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

Reply via email to