|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17300 bzcompress always outs "-8"
Submitted: 2002-05-17 20:12 UTC Modified: 2002-06-11 20:24 UTC
Avg. Score:3.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: x86zman at bigfoot dot com Assigned:
Status: Closed Package: Bzip2 Related
PHP Version: 4.3.0-dev OS: Windows
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:
23 - 5 = ?
Subscribe to this entry?

 [2002-05-17 20:12 UTC] x86zman at bigfoot dot com
bzcompress outs negative numbers (err codes ?) !

no matter whatever data length or type, blocksize or workfactor you may feed it with , the result is the same "-8" ...

i've searched the bug db before reporting and saw that you've marked this issue "closed" , and even moreover - that this extension seems problematic since 4.0.4 (almost since it've ever existed ...) !

could you plz fix (& stabilize ?) this extension at once ?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-25 06:45 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2002-05-25 21:10 UTC] x86zman at bigfoot dot com
Here's the "big" Code :


if (@function_exists('bzcompress'))
$file_ext .= '.bz2'; $file_mime_type = 'application/x-bzip';
$file_contents = bzcompress($file_contents,9);
	else { $file_mime_type = 'application/x-csv'; }

 [2002-05-26 03:58 UTC]
 [2002-06-04 14:02 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version 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.
Thank you for the report, and for helping us make PHP better.

Confirmed, 4.2.1 is broken. This bug is fixed in CVS, however.
 [2002-06-10 22:42 UTC] x86zman at bigfoot dot com
is was using (and the "-latest" too !) snap for testing , and guess what -> this bug is still alive ! (how unexpected ... ;)

and you may ref. this a docu. bug, but even so i've tested against the newest docs. in the site and in the d/lable man.(s) - nothing has changed !
 [2002-06-10 22:43 UTC] x86zman at bigfoot dot com
just marking the 4.3.0-dev too for carring this bug !
 [2002-06-11 01:13 UTC]
Give a small self-contained script which fails for you.

I wonder why it fails, it worked for me.

 [2002-06-11 10:43 UTC] x86zman at bigfoot dot com
i could'nt supply the whole script as it relies on external classes - but i've verified this code to generate the "-8" too !

than Here you go :



if (@function_exists('bzcompress'))
$test_data = bzcompress($test_data,9);
else { die(); }

// Send headers to the Browser (so it treats the output as a downloaded file)

ob_start(); // Output Buffering - Enables "Late" Header Transmission

header('Content-Type: application/x-bzip');

if ($_ENV["ETS_BROWSER_AGENT"] == 'IE') // IE need specific headers
        header('Content-Length: '.strlen($test_data));
        header('Content-Disposition: inline; filename="test_data.bz2"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: '.strlen($test_data));
        header('Content-Disposition: attachment; filename="test_data.bz2"');
        header('Expires: 0');
        header('Pragma: no-cache');

ob_end_clean(); // Output Buffering - End Cleanly

echo $test_data; // Output the File Contents Itself !

// File Download - Ends

 [2002-06-11 11:44 UTC]
Confirmed, finally. ext/bz2 is broken in Release_TS, but works in Debug_TS.
 [2002-06-11 11:49 UTC] x86zman at bigfoot dot com
Finally one takes a Full Checking upon this extension...
 [2002-06-11 11:54 UTC]
Setting to criticil. This may be related to streams, but not confirmed yet.
 [2002-06-11 17:18 UTC]
I've commited a fix no to CVS, but it needs some testing. Please wait a few hours from (don't know how long exactly) until the win32 snapshots are updated and try the latest then.

I wouldn't be surprised if you find some other problems with bz2 ...
 [2002-06-11 20:24 UTC] x86zman at bigfoot dot com
Fixed ! :)
Finally... (the MySQL extension (?) of the 4.3.0-dev is bad or changed - but that's probably get a new report of itself anyway ;)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun May 16 04:01:23 2021 UTC