|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 ? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Here's the "big" Code : [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'; } [/Code]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 : <?php $test_data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 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'); } else { 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 ?>