#34864 [Opn->Fbk]: HEAD request causes more than one output buffer not to pass on it's contents
| From: | sniper@php.net | Date: | Wed, 02 Nov 2005 13:22:32 +0000 |
| Subject: | #34864 [Opn->Fbk]: HEAD request causes more than one output buffer not to pass on it's contents | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-87407@lists.php.net to get a copy of this message | ||
ID: 34864
Updated by: sniper@php.net
Reported By: famtj at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: Output Control
Operating System: Unix
PHP Version: 4.4.0
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-10-14 03:37:40] famtj at yahoo dot com
Description:
------------
When more than one output buffers are chained together, and the client
requests the page via HEAD, the inner-most output buffer won't pass on
the buffer contents to the next buffer after modifying its code. It
seems to send a null string. It works fine with a PUT request.
Reproduce code:
---------------
<?php
function contentLength($html)
{
header('Content-Length: ' . strlen($html));
return ($html);
}
ob_start("contentLength");
function fix_code($buffer)
{
return(str_replace(" />", ">", $buffer));
}
ob_start("fix_code");
?>
<html><head>
<title>Bug</title>
</head><body>
<p>there is a bug</p>
</body></html>
Expected result:
----------------
HTTP/1.1 200 OK
Date: Fri, 14 Oct 2005 01:30:04 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0 mod_ssl/2.8.24 OpenSSL/0.9.7a
mod_perl/1.29 FrontPage/5.0.2.2635
X-Powered-By: PHP/4.4.0
Content-Length: 82
Connection: close
Content-Type: text/html
Actual result:
--------------
HTTP/1.1 200 OK
Date: Fri, 14 Oct 2005 01:29:20 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0 mod_ssl/2.8.24 OpenSSL/0.9.7a
mod_perl/1.29 FrontPage/5.0.2.2635
X-Powered-By: PHP/4.4.0
Content-Length: 0
Connection: close
Content-Type: text/html
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34864&edit=1