php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32648 register_shutdown_function output corrupted if zlib.output_compression is On
Submitted: 2005-04-09 21:17 UTC Modified: 2005-04-12 10:08 UTC
From: interghost at crovortex dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.4 OS: Windows XP/Linux
Private report: No CVE-ID: None
 [2005-04-09 21:17 UTC] interghost at crovortex dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-11 17:59 UTC] sniper@php.net
Manual is wrong here.

 [2005-04-12 10:08 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"Shutdown function is called after closing all opened output buffers thus, for example, its output will not be compressed if zlib.output_compression is enabled."
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 15 18:00:02 2025 UTC