|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
26 - 3 = ?
Subscribe to this entry?

 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 13:01:29 2024 UTC