php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19440 ob_clean and ob_end_clean are broken
Submitted: 2002-09-16 13:02 UTC Modified: 2002-10-18 16:19 UTC
From: madeinlisboa at yahoo dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.2.3 OS: W2K
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: madeinlisboa at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-09-16 13:02 UTC] madeinlisboa at yahoo dot com
When any of these 2 functions are called, I get no output or the output is garbled.
eg (I run this at the end of printable pages, to remove form fields, etc... Get buffer, change it, then print it):

$search = Array(
"|<script[^>]*?>.*?</script>|si",
"|<a href=\"#topo\">.*?</a>|si",
"|<form[^>]*?>.*?</form>|si",
"|<a[^>]*?>|si",
"|</a\s*>|si",
);

$contents = ob_get_contents();	// gets output buffer, empties it and print without forms
ob_clean();
echo preg_replace($search, '', $contents);

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-16 13:04 UTC] madeinlisboa at yahoo dot com
In the example I removed some elements from the array and forgot to delete last comma. sorry
 [2002-09-16 13:21 UTC] madeinlisboa at yahoo dot com
I found what is causing it. Setting "ob_gzhandler" as the default output handler in the php.ini or in a script, causes this behaviour.
if "ob_gzhandler" is not used, buffering is fine.
 [2002-09-19 18:57 UTC] madeinlisboa at yahoo dot com
I found the same problem with version 4.2.1 under Linux.
 [2002-10-18 13:48 UTC] madeinlisboa at yahoo dot com
Excuse me... what does bogus mean? Is it my report the bogus one or does it mean that there is really a problem??
I didn't see any answer here, so please, if this was a stupid bug submission, tell me what have I done wrong.
 [2002-10-18 16:19 UTC] msopacua@php.net
> I get no output or the output is garbled.
...
> Setting "ob_gzhandler" as the default output handler [...] causes this behaviour.

You confirmed correct behavior of ob_gzhandler. Please read the manual on what that does.

http://www.php.net/ob_gzhandler

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 14:01:29 2024 UTC