Bug #78792 [PATCH]: zlib.output_compression disabled by Content-Type: image/
Edit report at https://bugs.php.net/bug.php?id=78792&edit=1
ID: 78792
Patch added by: cmb@php.net
Reported by: ewgenij dot starostin at foo dot ag
Summary: zlib.output_compression disabled by Content-Type:
image/
Status: Open
Type: Bug
Package: Zlib related
PHP Version: 7.4.0RC5
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #78792: zlib.output_compression disabled by Content-Type: image/
On GitHub: https://github.com/php/php-src/pull/6198
Patch: https://github.com/php/php-src/pull/6198.patch
Previous Comments:
------------------------------------------------------------------------
[2019-11-07 17:11:06] ewgenij dot starostin at foo dot ag
The following patch has been added/updated:
Patch Name: revert-fix-for-bug-16109.patch
Revision: 1573146666
URL: https://bugs.php.net/patch-display.php?bug=78792&patch=revert-fix-for-bug-16109.patch&revision=1573146666
------------------------------------------------------------------------
[2019-11-07 17:09:55] ewgenij dot starostin at foo dot ag
Description:
------------
From PHP 4.3.2 onward until and including 7.4, setting zlib.output_compression to On and then
sending a Content-Type header whose value begins with image/ leads to zlib.output_compression being
reset to 0.
Old copies of the documentation (e. g. https://www.macs.hw.ac.uk/~hwloidl/docs/PHP/ref.zlib.html)
describe this behaviour, which is a fix for bug #16109:
> If you output a "Content-Type: image/" header the compression is disabled, too
> (in order to circumvent a Netscape bug). You can reenable it, if you add
> "ini_set('zlib.output_compression', 'On')" after the header call
> which added the
> image content-type.
Granting that it was intentional, is anyone even using an original Netscape user agent anymore and
is affected by their bug? (Bug 16109 was reproducible with Nescape Communicator 4.79â¦)
Otherwise, the relevant lines in main/SAPI.c sapi_header_op() (original commit 6f786ebf3e) could be
removed and save everyone the hassle of working around this â in a large code base, figuring
out when a header might be sent with the value having a specific prefix and adding
ini_get()/ini_set() calls at every such point is just annoying. Apart from Netscape
Navigator/Communicator users, nobody should be adversely affected by the change.
Test script:
---------------
<?php
// https://3v4l.org/2tV5T
ini_set('zlib.output_compression', 'On');
$v = ini_get('zlib.output_compression');
header('Content-Type: image/svg+xml');
var_dump($v, ini_get('zlib.output_compression'));
Expected result:
----------------
string(2) "On"
string(2) "On"
Actual result:
--------------
string(2) "On"
string(1) "0"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78792&edit=1
Thread (4 messages)