From 6a79e8afeb2038fa20796846fd1e2b64113112c3 Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <fox@madoka.volgo-balt.ru>
Date: Tue, 20 Mar 2012 14:45:43 +0400
Subject: [PATCH] only enable ob_gzhandler if it exists

---
 api/index.php | 4 +++-
 backend.php   | 2 +-
 public.php    | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/api/index.php b/api/index.php
index b8a6d4c4a..fd59f4bee 100644
--- a/api/index.php
+++ b/api/index.php
@@ -21,7 +21,9 @@
 
 	chdir("..");
 
-	if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT) {
+	if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT &&
+			function_exists("ob_gzhandler")) {
+
 		ob_start("ob_gzhandler");
 	}
 
diff --git a/backend.php b/backend.php
index 1337db5c2..efc3793d3 100644
--- a/backend.php
+++ b/backend.php
@@ -56,7 +56,7 @@
 
 	header("Content-Type: text/plain; charset=utf-8");
 
-	if (ENABLE_GZIP_OUTPUT) {
+	if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
 		ob_start("ob_gzhandler");
 	}
 
diff --git a/public.php b/public.php
index 8ffc83224..675a9e352 100644
--- a/public.php
+++ b/public.php
@@ -1,5 +1,5 @@
 <?php
-	set_include_path(get_include_path() . PATH_SEPARATOR . 
+	set_include_path(get_include_path() . PATH_SEPARATOR .
 		dirname(__FILE__) . "/include");
 
 	/* remove ill effects of magic quotes */
@@ -34,7 +34,7 @@
 
 	if (!init_connection($link)) return;
 
-	if (ENABLE_GZIP_OUTPUT) {
+	if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
 		ob_start("ob_gzhandler");
 	}
 
-- 
GitLab