From 3fbe07078fa57abe82b9584e11075a83ce15265a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 4 Jun 2012 19:54:01 -0700 Subject: Second attempt to fix #1821 - first attempt caused an infinite loop in some cases when zlib.output_compression is enabled. --- modules/gallery/controllers/file_proxy.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 36c6bc2a..47def436 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -128,7 +128,12 @@ class File_Proxy_Controller extends Controller { // going to buffer up whatever file we're proxying (and it may be very large). This may // affect embedding or systems with PHP's output_buffering enabled. while (ob_get_level()) { - ob_end_clean(); + Kohana_Log::add("error","".print_r(ob_get_level(),1)); + if (!@ob_end_clean()) { + // ob_end_clean() can return false if the buffer can't be removed for some reason + // (zlib output compression buffers sometimes cause problems). + break; + } } readfile($file); -- cgit v1.2.3