From:             interghost at crovortex dot com
Operating system: Windows XP/Linux
PHP version:      5.0.4
PHP Bug Type:     Output Control
Bug description:  Register_shutdown_function output corrupted if 
zlib.output_compression is On

Description:
------------
When using an echo/print inside a function called by
register_shutdown_function, AND while zlib.output_compression is set to
On, the last part of the output (whatever was echoed/printed in the
shutdown function) isn't compressed. 

PS:
I've found that this bug was already reported before but was classified as
"Bogus" with the explanation:
"The registered shutdown functions are called after the request has been
completed (including sending any output buffers), so it is not possible to
send output to the browser using echo() or print(), or retrieve the
contents of any output buffers using ob_get_contents()."

However it clearly states in the manual that:
"...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..."

Reproduce code:
---------------
function blah()
{
        echo "Shut down";
}
register_shutdown_function('blah');
echo "testing bug<p>";

Expected result:
----------------
testing bug<p>Shut down

Actual result:
--------------
With zlib.output_compression set to On in php.ini
In Mozilla based browsers:
testing bug<p>

In IE:
an empty document

The difference above is because of different error handling in the
browsers (I think) where Mozilla simply truncates the corrupted part while
IE displays nothing

Note: Set zlib.output_compression to Off and both browsers will display:
testing bug<p>Shut down

-- 
Edit bug report at http://bugs.php.net/?id=32648&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32648&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32648&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32648&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32648&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32648&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32648&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32648&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32648&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32648&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32648&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32648&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32648&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32648&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32648&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32648&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32648&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32648&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32648&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32648&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32648&r=mysqlcfg

Reply via email to