ID: 30015
Updated by: [EMAIL PROTECTED]
Reported By: php at terrarium dot f9 dot co dot uk
Status: Open
-Bug Type: Output Control
+Bug Type: Feature/Change Request
Operating System: Debian GNU/Linux Unstable
PHP Version: 4.3.8
New Comment:
This is not a bug as it works exactly as designed. Shutdown functions
run on an aborted or timed out connection as well. As such, they are
designed to be run after the connection has been terminated and all
output has been sent.
So at most this is a feature request to have some other level of clean
up function added.
Previous Comments:
------------------------------------------------------------------------
[2004-09-07 22:17:50] php at terrarium dot f9 dot co dot uk
Description:
------------
When using output buffering if the output buffer is still
open when the script terminates php automatically closes
it and writes the contents to the browser.
Unfortunately it does this before any functions which have
been registered with register_shutdown_function are
called, so these functions cannot manipulate or cancel the
output.
It also prevents shutdown_functions adding headers.
Reproduce code:
---------------
<?php
ob_start();
register_shutdown_function( 'clear_buffer' );
function clear_buffer() {
ob_end_clean();
}
echo 'Foo';
?>
Expected result:
----------------
No output displayed as the output buffer is cleared at the
end of the script
Actual result:
--------------
Foo is output
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30015&edit=1