diff --git a/CHANGELOG b/CHANGELOG index a1e4b4cd08..5214c846ca 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,7 +32,7 @@ Version 1.1.11 work in progress - Bug #859: Fixed CSort::applyOrder() and CSort::getOrderBy() to use custom table aliases (troch, samdark) - Bug #865: CLogRoute called processLogs() even if log array was empty and caused empty emails and log files (cebe) - Bug #879: Fixed a possible PHP error caused by CWebUser::restoreFromCookie() in combination with CHttpRequest.enableCookieValidation (kidol) -- Bug #901: Fixed possible encoding problem on exception (mdomba, samdark) +- Bug #901: Fixed possible encoding problem on exception (mdomba, samdark, cebe) - Bug #803: Arbitary non-sorting links in CDataColumn's header were not working proper way (resurtm) - Bug: Fixed CMenu::isItemActive() to work properly when there is a hash in the item's url (SlKelevro) - Bug: Added missing return statement to CAuthItem->revoke() (mdomba) diff --git a/framework/base/CErrorHandler.php b/framework/base/CErrorHandler.php index 8d36f6300f..5414c89d1c 100644 --- a/framework/base/CErrorHandler.php +++ b/framework/base/CErrorHandler.php @@ -97,12 +97,33 @@ public function handle($event) if($this->discardOutput) { + $gzHandler=false; + foreach(ob_list_handlers() as $h) + { + if(strpos($h,'gzhandler')!==false) + $gzHandler=true; + } // the following manual level counting is to deal with zlib.output_compression set to On + // for an output buffer created by zlib.output_compression set to On ob_end_clean will fail for($level=ob_get_level();$level>0;--$level) { - @ob_end_clean(); + if(!@ob_end_clean()) + ob_clean(); + } + // reset headers in case there was an ob_start("ob_gzhandler") before + if($gzHandler && !headers_sent() && ob_list_handlers()===array()) + { + if(function_exists('header_remove')) // php >= 5.3 + { + header_remove('Vary'); + header_remove('Content-Encoding'); + } + else + { + header('Vary:'); + header('Content-Encoding:'); + } } - header("Content-Encoding: ", true); } if($event instanceof CExceptionEvent)