From: nicolas dot grekas+php at gmail dot com
Operating system: all
PHP version: 5.2.0
PHP Bug Type: Feature/Change Request
Bug description: Create a way to capture/unset headers sent by ob_gzhandler ?
Description:
------------
Hi,
I would like to implement a fine tuned output compression mechanism, and I
can't with any of the actual PHP function.
Basically, what I want is a function that does exactly what ob_gzhandler
does, but without sending the headers is sends.
I've thought about two possibilities to enable this :
- the first is to implement a generic way to manage the headers buffer, ie
a way to delete a header, not just replace it. This is a very generic
solution, and I think it would benefit to PHP in general.
- the second would be to add an option, maybe a third parameter, to
ob_gzhandler.
What do you think of that ?
At least, it would be worth for me. Maybe for others too ?
Reproduce code:
---------------
Here is an example of a simple thing that don't work, but could be
interesting :
<?php
function my_obgz($buffer, $mode)
{
// This example miss some headers management,
// but the basic idea is here.
// And in fact, this headers managmement is impossible
// with actual the PHP functions.
$gz = ob_gzhandler($buffer, $mode);
if ($mode == (PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END))
{
if (strlen($gz) < strlen($buffer)) $buffer =& $gz;
}
else $buffer =& $gz;
return $buffer;
}
ob_start('my_obgz');
--
Edit bug report at http://bugs.php.net/?id=40324&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40324&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40324&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40324&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40324&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40324&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40324&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40324&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40324&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40324&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40324&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40324&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40324&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40324&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40324&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40324&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40324&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40324&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40324&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40324&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40324&r=mysqlcfg