[TYPO3-core] RFC #12498: t3lib_div::flushOutputBuffers can't work

Steffen Gebert steffen at steffen-gebert.de
Fri Nov 27 10:50:14 CET 2009


Hi Francois,

>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=12489
> Correct reference: http://bugs.typo3.org/view.php?id=12498
Thanks!

> Funnily enough your patch works even though it seems wrong. Indeed:
>
> $obContent .= ob_get_clean();
>
> this doesn't get the content, because ob_get_clean() returns a boolean
> (at least according to the PHP manual).
What manual do you use? Mine [1] says that it returns string.
"Gets the current buffer contents and delete current output buffer.
ob_get_clean() essentially executes both ob_get_contents() and  
ob_end_clean()."

Did you mix it up with ob_end_clean()?

> 1) I don't understand why the current code doesn't work. ob_end_flush is
> supposed to output the buffer then empty it. This does work in the case
> of the cli_dispatch script, for example. I don't know why it doesn't
> work for phpunit's BE module.
The problem with the current solution, which applies to phpunit and  
applied also to EM->Translation handling till some weeks ago is that there  
are two levels of output buffering, when compressionLevel is set. When you  
only flush one level, you loose everything.
I don't know, where the second level comes from, but as Translation  
handling works for everybody, I assume my solution with the while-loop is  
correct.

> 2) for your patch to work, header('Content-Encoding: None', TRUE); has
> to be added again. I'm wondering if this is correct, because the
> encoding might vary. Or does the output of each buffer just "join" the
> output of the main buffer which still has the correct encoding?
Resetting the Content-Encoding is needed with compressionLevel, as before  
already a "Content-Encoding: gzip" header has been queued (and now send  
unencoded).
Without compression level, we have no Content-Encoding and setting it to  
None again shouldn't hurt.
As I just found out, how to get a list of headers (headers_list() ;)),  
attached a patch, which first checks weather a Content-Encoding header was  
set.

> Any buffer guru out there who could clear things up?
Not a guru, but it took me two days to understand all problems coming with  
ob_gzhandler() and the single ob_end_flush() calls.

Steffen

[1] http://de.php.net/manual/de/function.ob-get-clean.php
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 12498_v3.diff
Type: text/x-diff
Size: 935 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091127/dfc71e06/attachment.diff>


More information about the TYPO3-team-core mailing list