View Issue Details

IDProjectCategoryView StatusLast Update
0002936mantisbtbugtrackerpublic2003-12-13 04:47
ReporterreporterAssigned Tojfitzell  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86OSWindows 2000 
Product Version0.18.0a1 
Summary0002936: SYSTEM WARNING: ob_gzhandler() used twice
Description

SYSTEM WARNING: ob_gzhandler() [<a href='<a href="http://www.php.net/ref.outcontrol'>ref.outcontrol</a&gt">http://www.php.net/ref.outcontrol'>ref.outcontrol</a&gt</a>;]: output handler 'ob_gzhandler' cannot be used twice
(compress_api.php: line 37)

error at the bottom of the view_all_bug_page.php (no problems accessing options)

I didn't find other pages with this bug

(Bert Huijben / Aim-4 / <a href="mailto:bert-mantisbt@a4scan.vsoft.nl" target="_new">bert-mantisbt@a4scan.vsoft.nl</a> / no account yet)

Steps To Reproduce

Just upgraded from 1.7.5..

Just visited bug overview.

TagsNo tags attached.

Activities

vboctor

vboctor

2003-02-16 14:52

manager   ~0003716

I could not reproduce this error. I even added code to detect multiple calls to compress_start() and it did not trap cases where compress_start() was called more than once.

vboctor

vboctor

2003-02-16 14:54

manager   ~0003717

Just for the record, I did my testing on PHP Version 4.2.3 / FreeBSD / Internet Explorer 6.

jfitzell

jfitzell

2003-02-16 17:52

reporter   ~0003720

The error message is stupid. It isn't that it's being called twice, it's that it was being applied to a nested output buffer and it only works when applied to the outermost output buffer.

This required some reworking but has been fixed in CVS.

Related Changesets

MantisBT: master dd4ac8a7

2003-02-16 20:50

Julian Fitzell


Details Diff
Fix issue 0002936: 'SYSTEM WARNING: ob_gzhandler() used twice'

I had to rework the compression stuff. The problem is that ob_gzhandler() can't be used on anything except the top-level output buffer (because the entire HTTP response has to be encoded). What I did was register our own handler in the ob_start() call in core.php. It always gets called and then *it* decides whether to call ob_gzhandler() based on the value of a global variable.

The result is that we can have nested output buffers again (though actually we end up not needing them -we just turn on compression when we want it instead of starting a new buffer) and also that error_api can disable compression again when it clears the buffer. This means that when an error is triggered on view_all_bug_page, you no longer see a blank screen.

* bug_view_advanced_page.php:
* bug_view_page.php:
* view_all_bug_page.php:
call compress_enable() instead of compress_start() and don't call compress_stop()

* core.php: give compress_handler as the output buffering handler

* core/compress_api.php
(compress_start): deleted
(compress_stop): deleted
(compress_is_enabled): check the value of the global variable too
(compress_handler): new function that handles the processing of the output
buffer, compressing it if appropriate
(compress_enable):
(compress_disable):
2 new functions that just set the state of the global variable

* core/error_api.php
(error_handler): call compress_disable() before ob_end_clear() so that the
GZIP encoded header doesn't get sent when our data isn't gzip encoded

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1895 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0002936
mod - core.php Diff File
mod - view_all_bug_page.php Diff File
mod - bug_view_advanced_page.php Diff File
mod - bug_view_page.php Diff File
mod - core/error_api.php Diff File
mod - core/compress_api.php Diff File