--- admin_menu.module	2009-05-17 17:59:23.000000000 +0200
+++ admin_menu.module	2009-05-17 18:55:41.000000000 +0200
@@ -273,17 +273,20 @@ function admin_menu_js_cache($hash = NUL
   // @todo According to http://www.mnot.net/blog/2006/05/11/browser_caching,
   //   IE will only cache the content when it is compressed.
   // Determine if the client accepts gzipped data.
-  if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && function_exists('gzencode')) {
-    if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) {
-      $encoding = 'gzip';
-    }
-    elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== FALSE) {
+  if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && extension_loaded('zlib')) {
+    if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== FALSE) {
       $encoding = 'x-gzip';
     }
+    elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) {
+      $encoding = 'gzip';
+    }
     if (!empty($encoding)) {
       header('Vary: Accept-Encoding');
       header('Content-Encoding: ' . $encoding);
-      $content = gzencode($content, 9, FORCE_GZIP);
+      // Compress content only if zlib.output_compression option is disabled.
+      if (zlib_get_coding_type() == FALSE) {
+        $content = gzencode($content, 9, FORCE_GZIP);
+      }
     }
   }
 
