Skip to content

Commit 47a166c

Browse files
committed
Fix #78792: zlib.output_compression disabled by Content-Type: image/
Disabling output compression for images has served to fix bug php#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 phpGH-6198.
1 parent 9f5a771 commit 47a166c

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ PHP NEWS
1818
- SPL:
1919
. SplFixedArray is now IteratorAggregate rather than Iterator. (alexdowad)
2020

21+
- Zlib:
22+
. Fixed bug #78792 (zlib.output_compression disabled by Content-Type: image/).
23+
(cmb)
24+
2125
17 Sep 2020, PHP 8.0.0beta4
2226

2327
- Core:

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ PHP 8.0 UPGRADE NOTES
662662
. deflate_init() will now return a DeflateContext object rather than a
663663
resource. Return value checks using is_resource() should be replaced with
664664
checks for `false`.
665+
. zlib.output_compression is no longer automatically disabled for
666+
Content-Type: image/*.
665667

666668
========================================
667669
2. New Features

main/SAPI.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,6 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
762762
len--;
763763
}
764764

765-
/* Disable possible output compression for images */
766-
if (!strncmp(ptr, "image/", sizeof("image/")-1)) {
767-
zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
768-
zend_alter_ini_entry_chars(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
769-
zend_string_release_ex(key, 0);
770-
}
771-
772765
mimetype = estrdup(ptr);
773766
newlen = sapi_apply_default_charset(&mimetype, len);
774767
if (!SG(sapi_headers).mimetype){

0 commit comments

Comments
 (0)