#30578 [Opn->Csd]: Output buffers flush explicitly before all variables have gone out of scope
| From: | sniper@php.net | Date: | Thu, 28 Apr 2005 07:51:17 +0000 |
| Subject: | #30578 [Opn->Csd]: Output buffers flush explicitly before all variables have gone out of scope | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-78346@lists.php.net to get a copy of this message | ||
ID: 30578
Updated by: sniper@php.net
Reported By: anthony at ectrolinux dot com
-Status: Open
+Status: Closed
Bug Type: Output Control
Operating System: *
PHP Version: 5CVS-2005-03-07
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Fix will be in PHP 5.1
Previous Comments:
------------------------------------------------------------------------
[2004-10-27 08:09:59] anthony at ectrolinux dot com
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 this bug report at http://bugs.php.net/?id=30578&edit=1