php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24315 ob_gzhandler fails with with sessions and trans_sid
Submitted: 2003-06-24 07:55 UTC Modified: 2003-07-24 10:05 UTC
From: usenet0 at malkusch dot de Assigned:
Status: Closed Package: Session related
PHP Version: 4.3.2 OS: Linux
Private report: No CVE-ID:
 [2003-06-24 07:55 UTC] usenet0 at malkusch dot de
Description:
------------
Hi

When using the ob_gzhandler (and no output_buffering is set in .htaccess) and using Sessions it won't compress the output.

And this happens only when PHP needs to rewrite the output because of trans_sid.

In PHP 4.3.0 additionally the Error "Warning: (null)() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in Unknown on line 0" occured.

Bye Markus Malkusch

Reproduce code:
---------------
<?php
session_start();
if (!isset($_SESSION['i'])) {
	$_SESSION['i'] = 1;
} else {
	$_SESSION['i']++;
}
ob_start('ob_gzhandler');
echo 'i = '.$_SESSION['i'];
?><a href="bug.html">bug.html</a>


Expected result:
----------------
A compressed output to the browser even, when URIs are rewritten.

Actual result:
--------------
No compressed output, when PHP has to rewrite the URIs.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-24 10:05 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

PHP now (latest stable CVS) reports the correct error message (ob_start(): output handler 'ob_gzhandler' cannot be used after 'URL-Rewriter') if you call ob_start('ob_gzhandler'); after session_start hs been called and trans_sid is used.
The solution is to call ob_start('ob_gzhandler'); before session_start().
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 22:02:05 2014 UTC