php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29125 ob_start('ob_gzhandler') and ob_clean() in a function.
Submitted: 2004-07-13 21:55 UTC Modified: 2004-07-14 09:45 UTC
From: justin at onyourmark dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.4 OS: FreeBSD 4.10-STABLE
Private report: No CVE-ID: None
 [2004-07-13 21:55 UTC] justin at onyourmark dot com
Description:
------------
The output buffer stops working if:
1) the output buffer was started with ob_start('ob_gzhandler');
2) a ob_clean() call is made from within a function.

Any subsequent ob_flush()/ob_end_flush()/ob_get_contents(), ect results in nothing being returned.

Bug #24951 seems to be similar to the problem I'm having. I'll run similar tests and report back the results, unless the issue is positivly identified before I finish the tests.

Reproduce code:
---------------
<?php
ob_start('ob_gzhandler');
echo "Shouldn't be displayed<br>";
test("Should be displayed<br>\n");
echo "Should be displayed too<br>";
ob_end_flush();

function test($str)
{
	ob_clean();
	echo $str;
}
?>

Expected result:
----------------
Should be displayed<br>
Should be displayed too<br>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-13 22:06 UTC] justin at onyourmark dot com
Incorrect initial listing of PHP version. Correct now.
 [2004-07-13 22:17 UTC] justin at onyourmark dot com
<?php
ob_start('ob_gzhandler');
echo 'should not be shown';
ob_clean();
echo 'should be shown';
ob_end_flush();
?>

This also results in nothing being displayed. Removing the ob_gzhandler results in the proper output of 'should be shown'.
 [2004-07-13 22:20 UTC] justin at onyourmark dot com
I just tested the code on a 4.3.7 box and it works, so I'm closing this bug, as it's obviously been fixed.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri May 20 18:05:43 2022 UTC