php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55544 ob_gzhandler always conflicts with zlib.output_compression
Submitted: 2011-08-31 02:58 UTC Modified: 2012-07-24 06:55 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: diogin at gmail dot com Assigned: laruence
Status: Closed Package: Output Control
PHP Version: 5.4.0alpha3 OS: Windows XP SP3 x86
Private report: No CVE-ID:
 [2011-08-31 02:58 UTC] diogin at gmail dot com
Description:
------------
Windows XP SP3 x86, Apache 2.2, PHP 5.4.0alpha3, with the following php.ini configuration options:

output_buffering = Off
zlib.output_compression = Off

Run this script twice through browser, you will see a warning and a notice:

<?php
ob_start('ob_gzhandler');
echo 'hello, world';
ob_end_flush();
?>

And the error messages are:

Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' conflicts with 'zlib output compression' in D:\soft\develop\web\php\5.4\0\var\index.php on line 2

Notice: ob_start() [ref.outcontrol]: failed to create buffer in D:\soft\develop\web\php\5.4\0\var\index.php on line 2
hello, world



Test script:
---------------
<?php
ob_start('ob_gzhandler');
echo 'hello, world';
ob_end_flush();
?>

Expected result:
----------------
No warnings or notices will be raised.

Actual result:
--------------
A warning and a notice are raised.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-19 14:19 UTC] mike@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mike
 [2011-09-19 14:36 UTC] mike@php.net
Automatic comment from SVN on behalf of mike
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=316992
Log: Fixed bug #55544 ob_gzhandler always conflicts with zlib.output_compression
 [2011-09-19 14:37 UTC] mike@php.net
-Status: Assigned +Status: Closed
 [2011-09-19 14:37 UTC] mike@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-13 10:25 UTC] jacky at prahec dot com
I have the same problem, using "php_value output_handler ob_gzhandler" in .htaccess produces the same warning all the time. I've been trying to bypass the problem but nothing works.

In 5.3.8 I didn't have that problem. So downgraded for now.

PHP Ini:
output_buffering = Off
zlib.output_compression = Off
 [2012-04-18 09:48 UTC] laruence@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8f857603b462c123c7b10191c691c0d0f2a6acbc
Log: Fixed bug #55544 ob_gzhandler always conflicts with zlib.output_compression
 [2012-06-11 22:36 UTC] php at pointpro dot nl
This issue remains on ArchLinux running: PHP 5.4.3 (built: May 31 2012 10:40:02).

Even though zlib.output_compression is set to Off in php.ini and phpinfo(); reports this setting as being off, I still get this warning message at each run of any PHP script. Or more specific:

PHP Warning:  Unknown: output handler 'zlib output compression' conflicts with 'ob_gzhandler' in Unknown on line 0

The same issue happens both when running through lighttpd as when using the CLI. If any more information is required, please let me know which.
 [2012-06-21 11:56 UTC] v dot a dot popov at gmail dot com
Seems to be a problem in merging the fix to actual branch, which releases are made of.
This commit:
http://git.php.net/?p=php-src.git;a=commit;h=85a62e9086db7a8ddfcda4ab1279a2439935f8d5
really fixes the problem, but relevant line is not present in php-5.4.3 and php-5.4.4.
 [2012-06-22 13:35 UTC] ewal at pointpro dot nl
You are right. It seems to be fixed in php-5.4.4-1; no more errors now. Thanks.
 [2012-07-02 07:26 UTC] dietmar at gps-tour dot info
Hi, it's not fixed in my PHP Version: 5.4.4-2~dotdeb.0

The Line "ZLIBG(output_compression) = 0;" in ext/zlib/zlib.c from the obove commit 
is not in the actual head or 5.4.4 branch anymore.
 [2012-07-17 14:15 UTC] bugs dot php at mohiva dot com
Same problem here. This bug isn't fixed in 5.4.5RC1.
 [2012-07-17 17:11 UTC] manu at gandi dot net
same problem open for 5.4.4:
https://bugs.php.net/bug.php?id=62335
 [2012-07-20 08:55 UTC] webmaster at abyssunderground dot co dot uk
Still present in the recent 5.4.5 update. Very frustrating.
 [2012-07-20 17:08 UTC] rasmus@php.net
-Status: Closed +Status: Re-Opened
 [2012-07-20 17:08 UTC] rasmus@php.net
Yes, something isn't being reset after the request when you use 
ob_start('ob_gzhandler')
 [2012-07-20 17:23 UTC] laruence@php.net
-Assigned To: mike +Assigned To: laruence
 [2012-07-20 18:56 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a6f1533789b897d3b8930b437164e81e0a0f4c72
Log: Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression)
 [2012-07-20 18:56 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a6f1533789b897d3b8930b437164e81e0a0f4c72
Log: Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression)
 [2012-07-20 18:58 UTC] laruence@php.net
-Status: Re-Opened +Status: Feedback
 [2012-07-20 18:58 UTC] laruence@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Hi, I've made a fix for this, could you please try with it?
 [2012-07-23 14:23 UTC] bugs dot php at mohiva dot com
The error message is gone, but the gzip compression doesn't work no longer.

The configuration that I use in php-fpm.conf is:
php_flag[output_buffering] = on
php_flag[zlib.output_compression] = off
php_value[output_handler] = ob_gzhandler

Can someone of the devs mark the bug 62335 as duplicate.
 [2012-07-24 02:44 UTC] laruence@php.net
I tested with php build server, didn't reproduce your issue.
test script: 
<?php
ob_start('ob_gzhandler');
echo 'hello, world';
ob_end_flush();
?>

server response:
HTTP/1.1 200 OK

Host: inf-dev-porsche.weibo.com:8964

Connection: close

X-Powered-By: PHP/5.5.0-dev

Content-Encoding: gzip

Vary: Accept-Encoding

Content-type: text/html
 [2012-07-24 03:33 UTC] laruence@php.net
-Status: Feedback +Status: Re-Opened
 [2012-07-24 03:33 UTC] laruence@php.net
oh, I mis-understand your codes,  verified.
 [2012-07-24 05:12 UTC] laruence@php.net
Here is the problem
ext/zlib/zlib.c
@@ -205,7 +205,7 @@ static int php_zlib_output_handler(void **handler_context, 
php_output_context *o
 		if (SUCCESS == 
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS, &flags TSRMLS_CC)) {
 			/* only run this once */
 			if (!(flags & PHP_OUTPUT_HANDLER_STARTED)) {
				if (SG(headers_sent) || 
!ZLIBG(output_compression)) {  

seems we need a bigger work to resolve this
 [2012-07-24 06:17 UTC] laruence@php.net
here is the confusion(assuming -d output_handler=ob_gzhandler -d 
zlib.output_compression=0) :

1. php.output_handler will change the ZLIGB(output_compression) before the zlib 
RINIT 
2. in zlib RINIT, we set the ZLIBG(output_compression) to default value(ini)

3. if we don't override the ZLIBG(output_compression), then in the 
php_zlib_output_compression_start which will be called in RINT will try to start 
zlib compression handler (although it depends on the requeset header), then, the 
conflict warning will be threw.

4. if we override it, then it the php_zlib_output_compression_start, it will 
return FALIURE, and no compression occurred(see the codes from my previous 
reply)

so, the key problem is multi-featrues depends on one global flag -> 
ZLIBG(output_compression).
 [2012-07-24 06:42 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c1e2bbd6f744b4048d4e0540ecc5dbe005494fe
Log: Re-fix bug #55544
 [2012-07-24 06:44 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4c1e2bbd6f744b4048d4e0540ecc5dbe005494fe
Log: Re-fix bug #55544
 [2012-07-24 06:55 UTC] laruence@php.net
re-fixed agian...
 [2012-07-24 06:55 UTC] laruence@php.net
-Status: Re-Opened +Status: Closed
 [2012-07-24 12:22 UTC] bugs dot php at mohiva dot com
Now, it works for me.
 [2012-07-24 23:39 UTC] rasmus@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8f857603b462c123c7b10191c691c0d0f2a6acbc
Log: Fixed bug #55544 ob_gzhandler always conflicts with zlib.output_compression
 [2012-07-29 11:36 UTC] knorge at gmx dot de
I want to test the mentioned snapshot but none of the links are working on this page: http://windows.php.net/snapshots/
Where have they gone? I am using Win7 x64 and this bug is driving me crazy for some time. Will it be finally fixed in PHP 5.4.6?
 [2013-04-21 10:12 UTC] sweet_philippe at hotmail dot com
Problems occurs for me on :

php-5.4.13-1.fc18.x86_64 + httpd-2.4.4-2.fc18.x86_64
and
php-5.4.11-1.fc18.x86_64 + httpd-2.4.3-15.fc18.x86_64

zlib.output_compression = Off in php.ini
With apache mod_deflate on or off it is the same.

Any advise to fix it please ?
 [2013-11-17 09:36 UTC] laruence@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8f857603b462c123c7b10191c691c0d0f2a6acbc
Log: Fixed bug #55544 ob_gzhandler always conflicts with zlib.output_compression
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 23:01:58 2014 UTC