Req->Bug #47758 [Opn->Fbk]: copy() may result in data loss
Edit report at https://bugs.php.net/bug.php?id=47758&edit=1
ID: 47758
Updated by: cmb@php.net
Reported by: nosp at m dot net
Summary: copy() may result in data loss
-Status: Open
+Status: Feedback
-Type: Feature/Change Request
+Type: Bug
-Package: Feature/Change Request
+Package: Filesystem function related
Operating System: Debian 64
PHP Version: 5.2.9
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> leave somefile unaltered
Actually, this is supposed to happen after bug #32160 had been
fixed. And I can't reproduce the described behavior under Debian
Jessie x64 (with none of the supported PHP versions). So if this
issue still persists for you, we need more information.
Anyhow, what you have described would be a bug (not an
improvement).
Previous Comments:
------------------------------------------------------------------------
[2009-03-24 13:15:06] nosp at m dot net
Description:
------------
copying a large file to itself result in a 64ko truncated file
Reproduce code:
---------------
$somepath = [path_to_a_file];
copy($somepath, $somepath);
Expected result:
----------------
leave somefile unaltered
Actual result:
--------------
on Debian 64-bit (not on OS X Leopard), any file > 64ko copied to itself result in a 64ko file.
i suppose that's because it copies files by 64ko blocks and writes block per block so after the
first block copy, the source is 64ko length.
as it can result in data loss and copying a file to itself should do nothing, i propose to raise a
warning and do nothing when copy has the same path for source and dest.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=47758&edit=1
Thread (3 messages)