This problem begins with output buffering. The check for the configuration variable is in system/core/Output.php
in _display()
. It starts gzipped buffering after a lot of code is already running. This leaves the potential for data output before buffering begins.
If compress_output
set to false
, it does not matter because nothing is encoded. When it is set to true
, you will get mixed content. Some output is encoded, and some of them do not result in a compression error.
There are two solutions:
1) You can leave compress_output
set to false and add ob_start('ob_gzhandler');
to the top of your index.php file. This ensures that all output is always gzipped, including errors.
2) Another solution is to add ob_flush();
before ob_start('ob_gzhandler');
in system/Output.php
. This will output gzip when there are no errors, and serve you unencrypted when there are errors.
I think 2 is the best solution and should be implemented by the CodeIgniter team. But if you do not want to guess the system code (the changes will go away during the upgrade), then 1 is the best solution for you.
source share