|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12631 Fatal: ob_get_length() returns wrong value when compressed OB is on
Submitted: 2001-08-07 14:11 UTC Modified: 2001-12-12 04:37 UTC
From: troels at arvin dot dk Assigned:
Status: Closed Package: Output Control
PHP Version: 4.0.6 OS: Linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: troels at arvin dot dk
New email:
PHP Version: OS:


 [2001-08-07 14:11 UTC] troels at arvin dot dk
When output buffering is on, using the gzhandler, then ob_get_length() returns the uncompressed content length in stead of the actual (compressed) payload.

This is fatal if a Content-Length HTTP-header is sent and the browser implements HTTP keep-alive. The result is a web-site which appears to be down or with extremely slow responses.

Example PHP code:



print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 30 a's
print "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; // 30 b's
print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 30 a's

header('Content-Length: '.ob_get_length());


If this is saved as http://localhost/ob.php then try the following wget command:

wget --header="Accept-Encoding: gzip" --header="Connection: close" -S http://localhost/ob.php
Notice that wget displays the following error message continuously:
Connection closed at byte 36. Retrying.

Also notice that the web-server told wget to expect 90 bytes (the uncompressed payload).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 04:37 UTC]
I might be wrong, but this is fixed in CVS or 4.1.0
Please reopen if problem exists in snapshot.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Oct 01 13:01:24 2023 UTC