|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71730 compression fails
Submitted: 2016-03-07 15:06 UTC Modified: 2021-08-01 04:22 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: wowkise at gmai dot com Assigned: cmb (profile)
Status: No Feedback Package: Output Control
PHP Version: 7.2 OS: ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: wowkise at gmai dot com
New email:
PHP Version: OS:


 [2016-03-07 15:06 UTC] wowkise at gmai dot com
if you take a look at the test script, the output_compression shouldn't have been sent, as there is an output before it,

however, on Ubuntu 15.10, Using php5-fpm nginx, the headers get sent anyway regardless if there is content before it or not, and that's breaks browsers, and shows errors such as 

This webpage is not available - ERR_CONTENT_DECODING_FAILED

Content Encoding Error

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

Test script:

$obj = (object) [
    'foo' => 'bar'

var_dump( $obj );

if ( !headers_sent() )
    ini_set( 'zlib.output_compression', 1 );

Expected result:
the header shouldn't have been sent.

Actual result:
the header get sent which garbled the output, which in turn breaks the output_compression, and causes the browsers to show error.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-14 11:19 UTC]
-Status: Open +Status: Verified -PHP Version: Irrelevant +PHP Version: 7.2
 [2018-06-14 11:19 UTC]
 [2018-06-14 11:26 UTC] spam2 at rhsoft dot net
"the headers get sent anyway regardless if there is content before" is technically wrong - they can't after the first body char and the problem is that compression happens even if sending the header fails - so the client get compressed content which was not announced
 [2018-07-07 15:51 UTC] wowkise at gmail dot com
rhsoft, you are correct what i meant is that headers_sent() check should have returned true as there was content that was sent, therefore headers cant be send anymore.
 [2018-07-07 16:08 UTC] spam2 at rhsoft dot net
anyways, zlib.output_compression is a bad idea!

other than apaches mod_defalte it don't take the client headers if it supports compression at all into account
 [2021-07-20 11:55 UTC]
-Status: Verified +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-20 11:55 UTC]
> the output_compression shouldn't have been sent, as there is an
> output before it

I don't think so.  Check the INI setting output_buffering[1] which
likely buffered the var_dump() output, so that headers_sent()
correctly returned true.

[1] <>
 [2021-08-01 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 07:01:30 2024 UTC