|  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: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: webrika at mail dot ru
New email:
PHP Version: OS:


 [2006-07-13 02:50 UTC] webrika at mail dot ru
stream_copy_to_stream() returns 0 when maxlength is bigger then the actual length. But copying is ok.

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

$src = fopen('', '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

Actual result:
39821 bytes copied
0 bytes copied


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-13 12:00 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 04:03:49 2023 UTC