php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15086 trans sid still doesn't work with zlib.compression or ob_gzhandler (PHP 4.1.1)
Submitted: 2002-01-17 11:03 UTC Modified: 2002-03-06 22:06 UTC
Votes:9
Avg. Score:4.9 ± 0.3
Reproduced:8 of 8 (100.0%)
Same Version:7 (87.5%)
Same OS:5 (62.5%)
From: Basc at Basc dot de Assigned: yohgaki (profile)
Status: Closed Package: Session related
PHP Version: 4.1.1 OS: Debian
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Basc at Basc dot de
New email:
PHP Version: OS:

 

 [2002-01-17 11:03 UTC] Basc at Basc dot de
When I compress my output with ob_gzhandler or with
zlib.output_compression trans sid doesn't work.
Without output compression trans sid works fine.
I use PHP 4.1.1 (Debian Package)

In following code php doesn't add the sid to the testlink
(sessioncookies are off)

<?php

session_start();
session_register("dummy");
$dummy=1;

if (!$sid) {
  header("Location: $PHP_SELF?".SID);
  exit();
}
?>

<a href="test.php">Testlink</a>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-06 22:20 UTC] yohgaki@php.net
Note to this report.

The reason trans sid does not work is related to output handler registration order.  This is not a simple fix at all.  (I might set status to Suspended)

User should make sure *not* to use session auto start to make trans sid when zlib.ouput compression is enabled. 

The reason SID is not defined is not related to output control.  
I also made a patch to define SID constant always, but it's not applied to CVS. (yet) 

If you have problem with SID not defined *even if* you have used
--enable-trans-sid when you configure PHP and session.trans_sid = 1 in your php.ini, please submit a new bug report as session problem.
 [2002-02-06 22:22 UTC] yohgaki@php.net
> User should make sure *not* to use session auto start to make trans sid
> when zlib.ouput compression is enabled. 

should be

User should make sure *not* to use session auto start to make trans sid work when zlib.ouput compression is enabled. 


 [2002-03-06 02:56 UTC] yohgaki@php.net
Could you try to start session manually in script and report the result?
Does it work now? I think it should.
 [2002-03-06 21:15 UTC] php at onethumb dot com
I've tried a number of different combinations of both php.ini settings (zlib.output_compression and session.auto_start) as well as in-line function calls (session_start, ob_start("ob_gzhandler")), and in every situation I've found, the transient SID is lost when compression is turned on.

Note that I'm using PHP 4.1.1 (4.1.2 is compiling as I type this) on RedHat Linux 7.2, and did compile it with --enable-trans-sid.

Here's a summary of the 5 different tests I tried:

[Test 1] 
php.ini:
	zlib.output_compression = Off
	session.auto_start = 0	
--snip--
<?
   session_start();
   session_register("testvar");
   $testvar = "test value";
?>

<a href="/test.php">Testing</a>
--snip--

Result:  PHPSESSID gets appended correctly. 


[Test 2]
php.ini:
	zlib.output_compression = Off
	session.auto_start = 1	
--snip--
<?
   session_register("testvar");
   $testvar = "test value";
?>

<a href="/test.php">Testing</a>
--snip--

Result:  PHPSESSID gets appended correctly.


[Test 3]
php.ini:
	zlib.output_compression = Off
	session.auto_start = 0	
--snip--
<?
   ob_start("ob_gzhandler");
   session_start();
   session_register("testvar");
   $testvar = "test value";
?>

<a href="/test.php">Testing</a>
--snip--

Result:  PHPSESSID is lost and not appended.


[Test 4]
php.ini:
	zlib.output_compression = On
	session.auto_start = 0
--snip--
<?
   session_start();
   session_register("testvar");
   $testvar = "test value";
?>

<a href="/test.php">Testing</a>
--snip--

Result:  PHPSESSID is lost and not appended.


[Test 5]
php.ini:
	zlib.output_compression = On
	session.auto_start = 1
--snip--
<?
   session_register("testvar");
   $testvar = "test value";
?>

<a href="/test.php">Testing</a>
--snip--

Result:  PHPSESSID is lost and not appended.
 [2002-03-06 21:36 UTC] php at onethumb dot com
Works like a charm!

Just tried 4.1.2 using ob_start("ob_gzhandler") and session_start(), and the SID was passed perfectly.

I'll fiddle with the php.ini settings too and see how we do, but that's definitely good enough for me.

Kudos!
 [2002-03-06 21:39 UTC] php at onethumb dot com
One last update...  :)

Using the php.ini values to turn session.auto_start and zlib.output_compression also appear to work great.

4.1.2 truly appears to fix this problem.
 [2002-03-06 22:06 UTC] yohgaki@php.net
Thank for feedback.
I'll update doc later so that user know what is going on.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 16:01:36 2025 UTC