php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63836 Don't work ob_gzhandler
Submitted: 2012-12-22 17:56 UTC Modified: 2012-12-28 10:44 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: if-post at ifinterface dot com Assigned:
Status: Not a bug Package: *Web Server problem
PHP Version: 5.4.10 OS: Windows XPx32 SP3
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: if-post at ifinterface dot com
New email:
PHP Version: OS:

 

 [2012-12-22 17:56 UTC] if-post at ifinterface dot com
Description:
------------
PHP 5.4.10
Windows XPx32 SP3
Apache/2.2.22 VC9

Don't work ob_gzhandler in ob_start('ob_gzhandler');
I don't receive header=Content-Encoding: gzip (realy don't zip)
when I specify header=Content-Length:

On Ubuntu 12.04x64 (Apache/2.2.22 PHP 5.4.9) - all ok!
On Windows XPx32 (Apache/2.2.22 VC9 PHP 5.3) - all ok!

Test script:
---------------
<?php
function fnecho($a){
ob_start('ob_gzhandler');

header("Content-Length: ".strlen($a));//to was without chunks

echo $a;
ob_end_flush();
}

fnecho("Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata...");
?>

Expected result:
----------------
header=Content-Encoding: gzip

Actual result:
--------------
Nothing = no zip.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-28 10:44 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2012-12-28 10:44 UTC] ab@php.net
You shouldn't send the content-length header. Just comment it out in your snippet and you'll get 

$ curl -v --compress http://localhost:8080/bug63836.php
* About to connect() to localhost port 8080 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /bug63836.php HTTP/1.1
> User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3
> Host: localhost:8080
> Accept: */*
> Accept-Encoding: deflate, gzip
>
< HTTP/1.1 200 OK
< Date: Fri, 28 Dec 2012 10:36:58 GMT
< Server: Apache/2.2.22 (Win32) PHP/5.4.11-dev
< X-Powered-By: PHP/5.4.11-dev
< Content-Encoding: gzip
< Vary: Accept-Encoding
< Content-Length: 46
< Content-Type: text/html
<
Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata... Anything... Tra-tata...* Connection #0 to host localhost left intact
* Closing connection #0


And, that's definitely wrong setting the content-length to the length of the uncompressed data.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC