#38086 [Opn->Csd]: stream_copy_to_stream() returns bad value

From: Date: Thu, 13 Jul 2006 12:00:22 +0000
Subject: #38086 [Opn->Csd]: stream_copy_to_stream() returns bad value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99397@lists.php.net to get a copy of this message
ID: 38086 Updated by: tony2001@php.net Reported By: webrika at mail dot ru -Status: Open +Status: Closed Bug Type: Streams related Operating System: FreeBSD 6.1 PHP Version: 5.1.4 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2006-07-13 02:50:24] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38086&edit=1

« previous php.bugs (#99397) next »