]> granicus.if.org Git - php/commitdiff
Fix #78792: zlib.output_compression disabled by Content-Type: image/
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 23 Sep 2020 21:52:27 +0000 (23:52 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Tue, 29 Sep 2020 09:30:06 +0000 (11:30 +0200)
Disabling output compression for images has served to fix bug #16109,
where zlib compressed images apparently have caused issues with
Navigator 4.  This shouldn't be an issue with somewhat contemporary
browsers.  Other than that, this is an arbitrary restriction – why
don't we disable the compression for some other media types as well
(e.g. video/* and audio/*)?  All in all, we should leave that decision
to userland.

Closes GH-6198.

NEWS
UPGRADING
main/SAPI.c

diff --git a/NEWS b/NEWS
index d9b7b57cfd0ff68eddb8d218837f18f5e63bdff3..f91bd85e71cd5ec77c48ecbf107841a426b15606 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,10 @@ PHP                                                                        NEWS
 - SPL:
   . SplFixedArray is now IteratorAggregate rather than Iterator. (alexdowad)
 
+- Zlib:
+  . Fixed bug #78792 (zlib.output_compression disabled by Content-Type: image/).
+    (cmb)
+
 17 Sep 2020, PHP 8.0.0beta4
 
 - Core:
index 9fdfe5b6bb035c8bc263d21acacabac9e64db9fe..c2e425ef116b9848cd22d2576853139cfad45bfc 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -662,6 +662,8 @@ PHP 8.0 UPGRADE NOTES
   . deflate_init() will now return a DeflateContext object rather than a
     resource. Return value checks using is_resource() should be replaced with
     checks for `false`.
+  . zlib.output_compression is no longer automatically disabled for
+    Content-Type: image/*.
 
 ========================================
 2. New Features
index 01ec31f72218ff132d08f2b0131ea9e3519f1582..0a7f219e847e59a5a2226ae9ced53ed2beb5bc22 100644 (file)
@@ -762,13 +762,6 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
                                        len--;
                                }
 
-                               /* Disable possible output compression for images */
-                               if (!strncmp(ptr, "image/", sizeof("image/")-1)) {
-                                       zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
-                                       zend_alter_ini_entry_chars(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
-                                       zend_string_release_ex(key, 0);
-                               }
-
                                mimetype = estrdup(ptr);
                                newlen = sapi_apply_default_charset(&mimetype, len);
                                if (!SG(sapi_headers).mimetype){