|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25106 bzwrite
Submitted: 2003-08-16 02:48 UTC Modified: 2003-09-15 19:48 UTC
Avg. Score:4.6 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:3 (75.0%)
From: batjohan at home dot se Assigned: wez (profile)
Status: Closed Package: Bzip2 Related
PHP Version: 4.3.3RC5-dev OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: batjohan at home dot se
New email:
PHP Version: OS:


 [2003-08-16 02:48 UTC] batjohan at home dot se
$handle = fopen ($file, "r");
$handle2 = bzopen($file2, "a");
$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:

Expected result:
To compress the file...  but it hangs...  when i use zlib it compress the file..  


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-19 04:39 UTC]
Using this script:

$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-09-15 19:48 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 05:01:33 2024 UTC