Bug #78792 [NEW]: zlib.output_compression disabled by Content-Type: image/
| From: | ewgenij dot starostin at foo dot ag | Date: | Thu, 07 Nov 2019 17:09:55 +0000 |
| Subject: | Bug #78792 [NEW]: zlib.output_compression disabled by Content-Type: image/ | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-223639@lists.php.net to get a copy of this message | ||
From: ewgenij dot starostin at foo dot ag
Operating system:
PHP version: 7.4.0RC5
Package: Zlib related
Bug Type: Bug
Bug description:zlib.output_compression disabled by Content-Type: image/
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 bug report at https://bugs.php.net/bug.php?id=78792&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78792&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78792&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78792&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78792&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78792&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78792&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78792&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78792&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78792&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78792&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78792&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78792&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78792&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78792&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78792&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78792&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78792&r=mysqlcfg