From 75a3af7d171ca760408e8899eb7ad332c857ba79 Mon Sep 17 00:00:00 2001 From: westi Date: Wed, 18 Jul 2007 21:12:22 +0000 Subject: [PATCH] Only enable gzip compression if it is not enabled in php.ini. Fixes #4426 git-svn-id: http://svn.automattic.com/wordpress/trunk@5810 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 21b917a3d..6a9123e0d 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -394,10 +394,16 @@ function maybe_serialize($data) { } function gzip_compression() { - if ( !get_option('gzipcompression') ) return false; + if ( !get_option( 'gzipcompression' ) ) { + return false; + } - if ( extension_loaded('zlib') ) { - ob_start('ob_gzhandler'); + if ( ( ini_get( 'zlib.output_compression' ) == 'On' || ini_get( 'zlib.output_compression_level' ) > 0 ) || ini_get( 'output_handler' ) == 'ob_gzhandler' ) { + return false; + } + + if ( extension_loaded( 'zlib' ) ) { + ob_start( 'ob_gzhandler' ); } }