php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60041 ob_gzhandler and ob_clean
Submitted: 2011-10-11 14:42 UTC Modified: 2011-10-13 09:10 UTC
From: jille at hexon dot cx Assigned: mike (profile)
Status: Not a bug Package: Output Control
PHP Version: 5.3.8 OS: n/a
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jille at hexon dot cx
New email:
PHP Version: OS:

 

 [2011-10-11 14:42 UTC] jille at hexon dot cx
Description:
------------
Calling ob_clean() after starting the ob_gzhandler screws up. ob_get_clean() doesn't seem to behave perfectly either.

There seem to be two problems:
* The gzip headers gets lost or is incorrect.
* The Content-Encoding header can be set even if the data is not gzip'ed (See test script 2)

Test script:
---------------
<?php
  ob_start('ob_gzhandler');
  // Do anything, doesn't matter whether you output anything or give an empty response.
  ob_clean();
?>

or
<?php
  ob_start('ob_gzhandler');
  echo "Hello world.";
  print ob_get_clean();
?>

Expected result:
----------------
HTTP/1.1 200 OK
Date: Tue, 11 Oct 2011 14:32:12 GMT
Server: Apache
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8

Connection closed by foreign host.


Actual result:
--------------
HTTP/1.1 200 OK
Date: Tue, 11 Oct 2011 14:32:12 GMT
Server: Apache
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8

[some data]
Connection closed by foreign host.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-11 22:13 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mike
 [2011-10-13 09:10 UTC] mike@php.net
-Status: Assigned +Status: Bogus
 [2011-10-13 09:10 UTC] mike@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See http://bugs.php.net/bug.php?id=36514
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 18:03:43 2023 UTC