Bug #71730 [Ver->Fbk]: compression fails

From: Date: Tue, 20 Jul 2021 11:55:31 +0000
Subject: Bug #71730 [Ver->Fbk]: compression fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71730&edit=1

 ID:                 71730
 Updated by:         cmb@php.net
 Reported by:        wowkise at gmai dot com
 Summary:            compression fails
-Status:             Verified
+Status:             Feedback
 Type:               Bug
 Package:            Output Control
 Operating System:   ubuntu
 PHP Version:        7.2
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> 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] <https://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering>


Previous Comments:
------------------------------------------------------------------------
[2018-07-07 16:08:15] 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

------------------------------------------------------------------------
[2018-07-07 15:51:13] 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-06-14 11:26:03] 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-06-14 11:19:07] mike@php.net

Verified

------------------------------------------------------------------------
[2016-03-07 15:06:40] wowkise at gmai dot com

Description:
------------
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 

Chrome:
This webpage is not available - ERR_CONTENT_DECODING_FAILED

Firefox:
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:
---------------
<?php

$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.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71730&edit=1


Thread (7 messages)

« previous php.bugs (#235207) next »