From: famtj at yahoo dot com
Operating system: Unix
PHP version: 4.4.0
PHP Bug Type: Output Control
Bug description: HEAD request causes more than one output buffer not to pass
on it's contents
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 bug report at http://bugs.php.net/?id=34864&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34864&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34864&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34864&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34864&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34864&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34864&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34864&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34864&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34864&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34864&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34864&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34864&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34864&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34864&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34864&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34864&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34864&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34864&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34864&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34864&r=mysqlcfg