php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38086 stream_copy_to_stream() returns bad value
Submitted: 2006-07-13 02:50 UTC Modified: 2006-07-13 12:00 UTC
From: webrika at mail dot ru Assigned:
Status: Closed Package: Streams related
PHP Version: 5.1.4 OS: FreeBSD 6.1
Private report: No CVE-ID:
 [2006-07-13 02:50 UTC] webrika at mail dot ru
Description:
------------
stream_copy_to_stream() returns 0 when maxlength is bigger then the actual length. But copying is ok.

Reproduce code:
---------------
$src = fopen('http://www.php.net', 'r');
$dest = fopen('ok.txt', 'w');
echo stream_copy_to_stream($src, $dest) . " bytes copied\n";
fclose($src); fclose($dest);

$src = fopen('http://www.php.net', 'r');
$dest = fopen('BUG.txt', 'w');
echo stream_copy_to_stream($src, $dest, 100000) . " bytes copied\n"; // returns zero
fclose($src); fclose($dest);

echo filesize('ok.txt')."\n";
echo filesize('BUG.txt')."\n";


Expected result:
----------------
39821 bytes copied
39821 bytes copied
39821
39821

Actual result:
--------------
39821 bytes copied
0 bytes copied
39821
39821

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-13 12:00 UTC] tony2001@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 13:02:46 2014 UTC