From 517ba3a6140cc26c6e1f340a4b5c2a3cc30063f2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 27 Nov 2023 14:25:53 +0100 Subject: [inc/Render] Fix gzip compressed output --- inc/render.inc.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/inc/render.inc.php b/inc/render.inc.php index 4318a95..c606fd8 100644 --- a/inc/render.inc.php +++ b/inc/render.inc.php @@ -32,10 +32,10 @@ class Render /** * Output the buffered, generated page */ - public static function output() + public static function output(): void { Header('Content-Type: text/html; charset=utf-8'); - $zip = isset($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false); + $zip = isset($_SERVER['HTTP_ACCEPT_ENCODING']) && (str_contains($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')); if ($zip) ob_start(); echo @@ -74,8 +74,7 @@ class Render ob_implicit_flush(false); $gzip_contents = ob_get_contents(); ob_end_clean(); - echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; - echo substr(gzcompress($gzip_contents, 5), 0, -4); + echo gzcompress($gzip_contents, 5, ZLIB_ENCODING_GZIP); } } -- cgit v1.2.3-55-g7522