php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20800 ob_and_clean crash
Submitted: 2002-12-03 15:54 UTC Modified: 2003-04-26 09:52 UTC
From: busia at tiscali dot it Assigned:
Status: Closed Package: Output Control
PHP Version: 4.3.0RC2 OS: Redhat 7.0
Private report: No CVE-ID: None
 [2002-12-03 15:54 UTC] busia at tiscali dot it
If I try to run this script I receive a blank page (no output):

<?
ob_end_clean();
echo "a";
?>

If I try to run from the command line it works.

Server configuration:

Linux Redhat 7.0
Apache 1.3.22
PHP 4.3.0RC2
Zend Optimizer 2.0.3
Mysql 4.0.5

ini:
output_buffering On
output_handler ob_gzhandler 

Configure:
'./configure' '--enable-track-vars' '--prefix=/usr' '--exec-prefix=/usr' '--libexecdir=/usr/lib/apache' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--datadir=/home/httpd' '--sysconfdir=/etc/httpd/conf' '--localstatedir=/var' '--libdir=/usr/lib/apache' '--includedir=/usr/include/apache' '--mandir=/usr/man' '--with-mysql=/usr' '--enable-memory-limit' '--with-config-file-path=/usr/local/Zend/etc' '--with-apxs' '--with-zlib'


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-04 00:34 UTC] moriyoshi@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2002-12-04 05:01 UTC] busia at tiscali dot it
The server doesn't create any core dump, it simply exit, as in bug #20802, there is no segmentation fault.
 [2002-12-04 12:53 UTC] moriyoshi@php.net
I just assumed you meant segfaults by the word "crash" :-)

Okay, Verified in HEAD, both with apache and with apache2.




 [2002-12-04 14:40 UTC] moriyoshi@php.net
As discussed in the past, this behaviour is supposed to be expected. Do not use ob_end_flush() without preceding ob_start() when gzip output handler is enabled.

 [2002-12-11 15:19 UTC] busia at tiscali dot it
But in "Bug #20642" edink@php.net suggests this solution to disable output buffering on a script base.

BTW Why no fatal error is shown?

How can I disable output buffering in a script?
 [2002-12-30 14:17 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

to disable output buffering from inside the script simply do:
ini_set("output_buffering", 0);

The reason you do not see an error is same reason that prevents you seeing the 'a' that you are trying to print.
 [2002-12-30 16:06 UTC] busia at tiscali dot it
I can't do:
ini_set("output_buffering", 0);

output_buffering isn't "PHP_INI_ALL" but is "PHP_INI_PERDIR|PHP_INI_SYSTEM". I cannot change it in scripts.
 [2003-04-26 09:52 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

To end the output buffering you'll need this code snippet:

// delete as much output buffers as possible
while(@ob_end_clean());
if (ob_get_level()) echo "Not all buffers were deleted.\n";

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 02:01:31 2024 UTC