ID: 30015
User updated by: php at terrarium dot f9 dot co dot uk
Reported By: php at terrarium dot f9 dot co dot uk
Status: Open
Bug Type: Feature/Change Request
Operating System: Debian GNU/Linux Unstable
PHP Version: 4.3.8
New Comment:
While I agree this is certainly the case in versions of
php < 4.1 the manual states:
"Since PHP 4.1, the shutdown functions are called as the
part of the request so that it's possible to send the
output from them. There is currently no way to process the
data after the request has been completed. "
Perhaps it is the documentation that needs clarifying but
it certainly gives the impression that with php >= 4.1
these functions are a valid place to manipulate the script
output.
Previous Comments:
------------------------------------------------------------------------
[2004-09-08 00:21:20] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
[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