Edit report at https://bugs.php.net/bug.php?id=65115&edit=1

 ID:                 65115
 Updated by:         m...@php.net
 Reported by:        preinhei...@php.net
 Summary:            flush() disables compression from ob_gzhandler
 Status:             Not a bug
 Type:               Bug
 Package:            Output Control
 Operating System:   linux
 PHP Version:        5.4.16
 Assigned To:        mike
 Block user comment: N
 Private report:     N

 New Comment:

Ok, my explanation pretty much applies to the Apache SAPI.

Due to premature flush()'ing the ob_gzhandler cannot set its headers anymore 
when it's actually run.


Previous Comments:
------------------------------------------------------------------------
[2013-06-25 13:56:15] preinhei...@php.net

I'm using the apache 2.0 SAPI.

The build of PHP I used to confirm the bug doesn't include XHProf (I wanted a 
clean build to report on). 

I built with: 
Command         './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' 
'--with-mysql=mysqlnd' '--with-gd' '--enable-soap' 
'--with-libxml-dir=/usr/lib/' '--with-mysql-sock=/tmp' '--with-tidy' 
'--with-jpeg-dir=/usr/lib/' '--with-xsl' '--with-curl' '--with-zlib' 
'--enable-gd-native-ttf' '--with-openssl' '--with-mcrypt' 
'--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-bz2' 
'--enable-bcmath'

------------------------------------------------------------------------
[2013-06-25 13:49:38] m...@php.net

Looks like my explanation off the top of my head was not correct.

Which SAPI are you using? Does XHPROF override SAPI methods?

------------------------------------------------------------------------
[2013-06-25 12:33:48] preinhei...@php.net

So if I run:

<?php
ob_start('ob_gzhandler');
phpinfo();
ob_flush();
phpinfo();
flush();

With something like:
curl -H "Accept-Encoding: gzip, deflate" http://test.local/obtest.php

It looks (to me) like the entire output is compressed. The difference in 
behavior seems, well, necessary to allow the end agent to actually be able to 
read the output. But confusing from a "different output depending on what 
happened earlier" standpoint.

------------------------------------------------------------------------
[2013-06-25 05:30:36] m...@php.net

Actually, this is debatable. Flush 
flushes the SAPI's I/O layer and we 
just note that output has 
irreversibly sent. If you want to 
flush the output buffering layer 
you have to use ob_flush prior 
flush.

------------------------------------------------------------------------
[2013-06-25 04:32:20] larue...@php.net

I encountered this problem too.

a workaround is don't use php's gzip handler, use the webserver's

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=65115


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65115&edit=1

Reply via email to