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: Assigned +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: 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. Previous Comments: ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ [2013-06-24 21:08:07] preinhei...@php.net Description: ------------ Hi, Consider the test script. One might expect to see: Content-Encoding: gzip in the response headers, but it's not there. If however you comment out that flush() compression is applied. As a small amount of background, I work on two tools that help display data from the xhprof extension. They both include flush(); ignore_user_abort(); before doing work to store the profiling information in attempt to have as little impact on the user as possible. Clearly flush() wasn't the safe command I thought it was, as it's having a large affect on the application I'm profiling. I'm prepared to write this up in the documentation, but I don't really think this is expected behavior. Test script: --------------- <?php ob_start('ob_gzhandler'); phpinfo(); flush(); Expected result: ---------------- output compressed Actual result: -------------- no compression ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65115&edit=1