Edit report at https://bugs.php.net/bug.php?id=60041&edit=1
ID: 60041 Updated by: m...@php.net Reported by: jille at hexon dot cx Summary: ob_gzhandler and ob_clean -Status: Assigned +Status: Bogus Type: Bug Package: Output Control Operating System: n/a PHP Version: 5.3.8 Assigned To: mike Block user comment: N Private report: N New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. See http://bugs.php.net/bug.php?id=36514 Previous Comments: ------------------------------------------------------------------------ [2011-10-11 14:42:29] jille at hexon dot cx Description: ------------ Calling ob_clean() after starting the ob_gzhandler screws up. ob_get_clean() doesn't seem to behave perfectly either. There seem to be two problems: * The gzip headers gets lost or is incorrect. * The Content-Encoding header can be set even if the data is not gzip'ed (See test script 2) Test script: --------------- <?php ob_start('ob_gzhandler'); // Do anything, doesn't matter whether you output anything or give an empty response. ob_clean(); ?> or <?php ob_start('ob_gzhandler'); echo "Hello world."; print ob_get_clean(); ?> Expected result: ---------------- HTTP/1.1 200 OK Date: Tue, 11 Oct 2011 14:32:12 GMT Server: Apache Content-Encoding: gzip Vary: Accept-Encoding Content-Length: 0 Connection: close Content-Type: text/html; charset=utf-8 Connection closed by foreign host. Actual result: -------------- HTTP/1.1 200 OK Date: Tue, 11 Oct 2011 14:32:12 GMT Server: Apache Content-Encoding: gzip Vary: Accept-Encoding Content-Length: 0 Connection: close Content-Type: text/html; charset=utf-8 [some data] Connection closed by foreign host. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60041&edit=1