Edit report at https://bugs.php.net/bug.php?id=30015&edit=1

 ID:                 30015
 Updated by:         ni...@php.net
 Reported by:        php at terrarium dot f9 dot co dot uk
 Summary:            output buffer closed before shutdown functions
                     called
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Debian GNU/Linux Unstable
 PHP Version:        4.3.8
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Closing as this was already fixed in the meantime.


Previous Comments:
------------------------------------------------------------------------
[2004-09-08 16:01:39] php at terrarium dot f9 dot co dot uk

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.

------------------------------------------------------------------------
[2004-09-08 00:21:20] ras...@php.net

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 https://bugs.php.net/bug.php?id=30015&edit=1

Reply via email to