|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78792 zlib.output_compression disabled by Content-Type: image/
Submitted: 2019-11-07 17:09 UTC Modified: 2020-09-23 21:58 UTC
From: ewgenij dot starostin at foo dot ag Assigned: cmb (profile)
Status: Closed Package: Zlib related
PHP Version: 7.4.0RC5 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ewgenij dot starostin at foo dot ag
New email:
PHP Version: OS:


 [2019-11-07 17:09 UTC] ewgenij dot starostin at foo dot ag
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. 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:
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"


revert-fix-for-bug-16109.patch (last revision 2019-11-07 17:11 UTC by ewgenij dot starostin at foo dot ag)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-07 17:11 UTC] ewgenij dot starostin at foo dot ag
The following patch has been added/updated:

Patch Name: revert-fix-for-bug-16109.patch
Revision:   1573146666
 [2020-09-23 21:56 UTC]
The following pull request has been associated:

Patch Name: Fix #78792: zlib.output_compression disabled by Content-Type: image/
On GitHub:
 [2020-09-23 21:58 UTC]
-Assigned To: +Assigned To: cmb
 [2020-09-29 09:30 UTC]
Automatic comment on behalf of
Log: Fix #78792: zlib.output_compression disabled by Content-Type: image/
 [2020-09-29 09:30 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 09:01:30 2024 UTC