#29532 [NEW]: bzread reads incorrect quantity of byte

From: Date: Thu, 05 Aug 2004 10:37:58 +0000
Subject: #29532 [NEW]: bzread reads incorrect quantity of byte
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64123@lists.php.net to get a copy of this message
From: bitlz at nezabudka dot ru Operating system: windows 2000 server sp 4 PHP version: 5.0.0 PHP Bug Type: Bzip2 Related Bug description: bzread reads incorrect quantity of byte Description: ------------ in documentation: string bzread ( resource bz [, int length]) really: if used length more than 8192, bzread reads incorrect quantity of byte ( 8192 ). version php: PHP 5.0.0 (cli) (built: Jul 13 2004 21:39:58) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies Reproduce code: --------------- qqq.php: $fpbz = bzopen("1.txt.bz2", "wb"); $fp = fopen("1.txt", "rb"); $a = filesize("1.txt"); echo $a."\n"; $buf = fread($fp,filesize("1.txt")); $buf = bzwrite($fpbz, $buf); bzclose($fpbz); fclose($fp); $fp = fopen("2.txt", "wb"); $fpbz = bzopen("1.txt.bz2", "rb"); $buf = bzread($fpbz, $a); fwrite($fp,$buf, $a); bzclose($fpbz); fclose($fp); $a = filesize("2.txt"); echo $a."\n"; Expected result: ---------------- expected result: D:\@\Work\work\fma\4_1c>php qqq.php 60201 60201 D:\@\Work\work\fma\4_1c> Actual result: -------------- actual result: D:\@\Work\work\fma\4_1c>php qqq.php 60201 8192 D:\@\Work\work\fma\4_1c> -- Edit bug report at http://bugs.php.net/?id=29532&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29532&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29532&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29532&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29532&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29532&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29532&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29532&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29532&r=support Expected behavior: http://bugs.php.net/fix.php?id=29532&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29532&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29532&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29532&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29532&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29532&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29532&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29532&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29532&r=float

« previous php.bugs (#64123) next »