#30578 [NEW]: Output buffers flush explicitly before all variables have gone out of scope
| From: | anthony at ectrolinux dot com | Date: | Wed, 27 Oct 2004 06:10:10 +0000 |
| Subject: | #30578 [NEW]: Output buffers flush explicitly before all variables have gone out of scope | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-68375@lists.php.net to get a copy of this message | ||
From: anthony at ectrolinux dot com
Operating system: Gentoo Linux
PHP version: 5.0.2
PHP Bug Type: Output Control
Bug description: Output buffers flush explicitly before all variables have gone out of scope
Description:
------------
During script termination, PHP's explicit output buffer flush should wait
until all variables have gone -completely- out of scope. Using an
instantiated object that manages buffers, the data has already been
flushed before __destruct() is called, which prevents the script from
properly finalizing data collection and flushing the output normally. This
is not the appropriate behavior.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
class Example
{
function __construct()
{
ob_start();
echo 'This should be displayed last.'."\n";
}
function __destruct()
{
$buffered_data = ob_get_contents();
ob_end_clean();
echo 'This should be displayed first.'."\n";
echo 'Buffered data: '. $buffered_data;
}
}
$obj = new Example;
?>
Expected result:
----------------
This should be displayed first.
Buffered data: This should be displayed last.
Actual result:
--------------
This should be displayed last.
Notice: ob_end_clean(): failed to delete buffer. No buffer to delete. in
/--snip--/test.php on line 17
This should be displayed first.
Buffered data:
--
Edit bug report at http://bugs.php.net/?id=30578&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30578&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30578&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30578&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30578&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30578&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30578&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30578&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30578&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30578&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30578&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30578&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30578&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30578&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30578&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30578&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30578&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30578&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30578&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30578&r=mysqlcfg