php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50657 copy() with an empty (zero-byte) HTTP source succeeds but returns false
Submitted: 2010-01-04 15:51 UTC Modified: 2010-01-06 12:55 UTC
From: php at lorddeath dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.3SVN-2010-01-04 (snap) OS: Win32/Linux
Private report: No CVE-ID: None
 [2010-01-04 15:51 UTC] php at lorddeath dot net
Description:
------------
The copy() function returns false (but otherwise succeeds in copying the 
file) when the source file is accessed via a HTTP stream, but is empty 
(zero bytes).  Other, non-HTTP, stream types might also be affected, but 
local files are definitely *NOT* affected.

I have successfully reproduced this bug with PHP 5.2.9 on Linux, and 
5.2.5, 5.2.12, 5.3.0, 5.3.1 and 5.3.3-dev (2010-Jan-04 15:00:00) on 
Windows.

(I will keep the empty.txt URL in the reproduce code accessible for a 
while.)

Reproduce code:
---------------
$r = copy("http://lspace.sihnon.net/pub/empty.txt", "temp");
var_dump($r);

Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 21:56 UTC] jani@php.net
Was the file always returning 404 ? 
 [2010-01-04 21:57 UTC] jani@php.net
Nevermind, the auto-link-thing in this crappy bug tracker messed the url. :)
 [2010-01-04 22:07 UTC] jani@php.net
_php_stream_copy_to_stream_ex() contains the problem, it assumes read length of 0 to be an error..
 [2010-01-06 12:54 UTC] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=293175
Log: Fixed bug #50657 (copy() with an empty (zero-byte) HTTP source succeeds but returns false).
 [2010-01-06 12:55 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2010-02-05 00:39 UTC] svn@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=294550
Log: - Fixed bug #50657
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 22:01:27 2024 UTC