yiisoft/yii — pull request #984 by cebe (2012-07-16 02:12:44+00:00)
Title: improved CErrorHandler::discardOutput in case of gzipped output

when output is gzipped with zlib.output_compression set to On
ob_end_clean will not succeed so we try to ob_clean()

when output is gzipped by calling `ob_start("ob_gzhandler");` on
application startup we have to reset Content-Encoding and Vary header
when ob_end_clean kills that output handler.
this would work with `header('Content-Encoding:');` but when apache
module mod_deflate is activated a broken Content-Encoding header is
added:
`Content-Encoding: ,gzip`, so we try header_remove which is available
since php 5.3.
for php < 5.3 and mod_deflate there is not practial solution.

btw: php documentation says zlib.output_compression set to On is the
recomented way for output compression

tested this with the following settings:
*no compression*
- apache mod_deflate turned on
- apache mod_deflate turned off

*zlib.output_compression*
- apache mod_deflate turned on
- apache mod_deflate turned off

*kompression using ob_start("ob_gzhandler");*
- apache mod_deflate turned on + header('Content-Encoding:')
- apache mod_deflate turned on + header_remove('Content-Encoding')
- apache mod_deflate turned off + header('Content-Encoding:')
- apache mod_deflate turned off + header_remove('Content-Encoding')