#25106 [Asn]: bzwrite

From: Date: Tue, 19 Aug 2003 09:40:14 +0000
Subject: #25106 [Asn]: bzwrite
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46192@lists.php.net to get a copy of this message
ID: 25106 Updated by: sniper@php.net Reported By: batjohan at home dot se Status: Assigned Bug Type: Bzip2 Related -Operating System: Windows XP +Operating System: * PHP Version: 4.3.3RC5-dev Assigned To: wez New Comment: btw. I tested on Linux.. Previous Comments: ------------------------------------------------------------------------ [2003-08-19 04:39:51] sniper@php.net Using this script: <?php $file = '/etc/group'; // just some file.. :) $file2 = './foo.bz2'; $handle = fopen ($file, "r"); $handle2 = bzopen($file2, "a"); // 'w' works fine $buffer = fread($handle, 8192); if(!bzwrite($handle2, $buffer, strlen($buffer))) { echo "Foo\n"; } ?> The first run (when foo.bz2 does not exist) produces this error: Warning: bzwrite(): supplied argument is not a valid stream resource in /home/jani/t.php on line 8 Second run (foo.bz2 exists) -> Hangs. ------------------------------------------------------------------------ [2003-08-16 15:49:45] batjohan at home dot se same problem. ------------------------------------------------------------------------ [2003-08-16 11:51:42] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-08-16 02:48:47] batjohan at home dot se Description: ------------ $handle = fopen ($file, "r"); $handle2 = bzopen($file2, "a"); fseek($handle,$vart); $buffer = fread($handle, 8192); if(!bzwrite($handle2, $buffer, strlen($buffer))) // <-- here it stops.. dont write something out... create a new file not more... Reproduce code: --------------- http://www2.park.se/~te04-54/bug.html Expected result: ---------------- To compress the file... but it hangs... when i use zlib it compress the file.. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25106&edit=1

« previous php.bugs (#46192) next »