I've just thought of a fairly obvious solution to the bug that causes output buffering to break when trying to clean a buffer that uses the ob_gzhandler compression handler.
It's a bit crude perhaps; it works on the principle of using a top level buffer with gzhandler, then always using a nested 'plain' buffer for directly capturing output. This way, the plain buffers can always be cleaned, but the compression will still be applied when the script ends.
At the begining of your script, start buffering with two buffers:
PHP Code:
ob_start('ob_gzhandler');
ob_start();
Then if you need to clean the buffers down to any that use ob_gzhandler, use something like this:
PHP Code:
$end=false;
do {
$status = ob_get_status();
if($status['name'] == 'ob_gzhandler') {
$end=true;
} else {
@ob_end_clean();
}
} while (!$end);
Bookmarks