php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22698 'ob_gzhandler' cannot be used twice: still present in 4.3.1 when using sessions
Submitted: 2003-03-14 05:50 UTC Modified: 2003-04-26 10:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: bilo at mit dot it Assigned:
Status: Closed Package: Session related
PHP Version: 4.3.1 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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bilo at mit dot it
New email:
PHP Version: OS:

 

 [2003-03-14 05:50 UTC] bilo at mit dot it
Since I've upgraded to php 4.3.1 I'm getting the following error with my scripts using ob_gzhandler:

Warning: (null)() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in Unknown on line 0

The wierd thing is that I was getting the warning just when opening the page for the first time, while subsequent ones where ok. 

I've lurked across the archive. There's the claim that that problem had been fixed but imho it has not been fixed completely (see below). As a workaround I've found that I've to check if some other handler is loaded before trying to compress. I did it and I'm no longer getting that error.

By the way I don't know who is starting that handler!


In my configuration I've set:

  output_buffering        = Off
  output_handler          =
  zlib.output_compression = Off

The following script reproduces the problem:

<?
    session_start();

    $_SESSION['N'] =  (isset($_SESSION['N']) ? ++$_SESSION['N'] : 1);

    echo "Level = " . ob_get_level() . ";<br>";
    echo "Iteration = " . $_SESSION['N'] . ";<br>";
?>

The first time it's launched I get "Level = 1".
From the second iteration on, I get "Level = 0".


It looks like that starting a session makes an ob handler start.

Is this behaviour correct?

I'm using RedHat Linux 6.2 with kernel 2.2.18, glibc-2.1.3-28, gcc-2.96-98, apache 1.3.27 and php 4.3.1.
This is my "configure" line:

./configure \
    --with-apxs=/usr/sbin/apxs \
    --with-config-file-path=/etc/httpd/conf \
    --with-java=/usr/java/jdk1.3.1_02 \
    --disable-cgi \
    --with-tsrm-pthreads \
    --enable-trans-sid \
    --enable-sysvsem \
    --enable-sysvshm \
    --with-zlib \
    --with-ssl=shared \
    --with-dom=shared \
    --enable-xslt=shared \
      --with-xslt-sablot \
    --with-curl=shared \
    --with-gd \
      --with-jpeg-dir \
      --enable-gd-native-ttf \
      --enable-gd-imgstrttf \
    --with-mysql=shared \
    --with-recode=shared \
    --enable-calendar \
    --enable-dba=shared \
      --with-gdbm \
      --with-ndbm \
      --with-cdb \
      --with-db2 \
      --with-flatfile\
    --with-kerberos

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-14 09:53 UTC] sniper@php.net
Set session.use_trans_sid = 0 in your php.ini.

 [2003-03-14 10:34 UTC] bilo at mit dot it
Ok.

I'll try.

BTW ... Why? And what does setting this parameter to
off changes for me in the way I write scripts and pages ?

I see that a cookie with PHPSESSID is still sent. Does
this mean that I have to add "&PHPSESSID=xxxxxxx" to each
URI when cookies are not available?
 [2003-03-14 11:13 UTC] sniper@php.net
So did it 'fix' this problem or not?

 [2003-03-17 03:59 UTC] bilo at mit dot it
Yes it did, thank you.
 [2003-04-08 20:54 UTC] dave at toad dot net
For what it's worth, I have session.use_trans_sid = 0 and I am getting:

[Tue Apr  8 21:48:31 2003] [error] PHP Warning:  (null)() [<a href='http://www.php.net/ref.outcontrol'>ref.outcontrol</a>]: o
utput handler 'ob_gzhandler' cannot be used twice in Unknown on line 0

This is with current horde/imp; I am not aware that the ob_gzhandler is being invoked anyplace in particular.
 [2003-04-14 13:39 UTC] voided at deviantnewmedia dot com
same here with horde/imp.

turned off session.use_trans_sid and i am getting :

Warning: (null)() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in Unknown on line 0
 [2003-04-14 14:16 UTC] voided at deviantnewmedia dot com
ok it looks like the scripts make use of:  

ob_start('ob_gzhandler');

and since it is already included in php.ini it gives out the error seen previously...
 [2003-04-26 10:01 UTC] helly@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

The check is correct and as you wrote, it was a missconfiguration or seen from another point it was an additional erroneous ob_start call.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 13:03:40 2023 UTC