Reverted regression with ob_clean() called even when ob_start() was not

executed, introduced in cb3100f71f Refs #864.  Fixes #882
This commit is contained in:
mark_story 2010-07-03 17:21:02 -04:00
parent 17a7a96ba2
commit f9de88d6cf

View file

@ -615,7 +615,8 @@ class Dispatcher extends Object {
*/ */
function _deliverAsset($assetFile, $ext) { function _deliverAsset($assetFile, $ext) {
$ob = @ini_get("zlib.output_compression") !== '1' && extension_loaded("zlib") && (strpos(env('HTTP_ACCEPT_ENCODING'), 'gzip') !== false); $ob = @ini_get("zlib.output_compression") !== '1' && extension_loaded("zlib") && (strpos(env('HTTP_ACCEPT_ENCODING'), 'gzip') !== false);
if ($ob && Configure::read('Asset.compress')) { $compressionEnabled = $ob && Configure::read('Asset.compress');
if ($compressionEnabled) {
ob_start(); ob_start();
ob_start('ob_gzhandler'); ob_start('ob_gzhandler');
} }
@ -642,11 +643,13 @@ class Dispatcher extends Object {
if ($ext === 'css' || $ext === 'js') { if ($ext === 'css' || $ext === 'js') {
include($assetFile); include($assetFile);
} else { } else {
if ($compressionEnabled) {
ob_clean(); ob_clean();
}
readfile($assetFile); readfile($assetFile);
} }
if (Configure::read('Asset.compress')) { if ($compressionEnabled) {
ob_end_flush(); ob_end_flush();
} }
} }