From: glideraerobatics at hotmail dot com
Operating system: Linux
PHP version: 5.0.2
PHP Bug Type: HTTP related
Bug description: Duplicated headers + missing headers in response
Description:
------------
I've noticed numerous times that certain headers produced by PHP scripts
are duplicated. Another problem is that the Content-Length header is set
in code, but is missing in the output.
See below the expected and actual responses. Actual response discards the
Content-Length header and duplicates the Content-Disposition header.
I sent this request to the PHP script to test it:
HEAD /download.php/458/Cats_in_the_Cradle.mid HTTP/1.1
Host: wapxtc.nl
accept-language: nl
user-agent: SonyEricssonT230/R101
cache-control: no-cache
accept: text/vnd.wap.wml,text/vnd.wap.wmlscript,*/*;q=0.001
accept-charset: us-ascii,iso-8859-1,utf-8,iso-10646-ucs-2,*;q=0.001
accept-encoding: *;q=0.001
FYI: I'm running Apache 2 (stable) on PHP5.02 (stable) on Linux.
Reproduce code:
---------------
// $data contains blob
header('Content-Length: ' . strlen($data));
header('Content-Type: ' . $item['MIMETYPE']);
header('Content-Disposition: inline; filename="' . $filename . '"');
// This outputs the 3 lines above in the error_log as expected:
error_log(implode("\n",headers_list()));
if ($_SERVER['REQUEST_METHOD'] != 'HEAD') {
print $data;
}
exit;
Expected result:
----------------
HTTP/1.1 200 OK
Content-Disposition: inline; filename="Cats_in_the_Cradle.mid"
Last-Modified: Mon, 18 Oct 2004 13:23:52 GMT
Content-Type: audio/midi
Content-Length: 6331
Actual result:
--------------
HTTP/1.1 200 OK
Content-Disposition: inline; filename="Cats_in_the_Cradle.mid"
Last-Modified: Mon, 18 Oct 2004 13:23:52 GMT
Content-Type: audio/midi
Content-Disposition: inline; filename="Cats_in_the_Cradle.mid"
--
Edit bug report at http://bugs.php.net/?id=30502&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30502&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30502&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30502&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30502&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30502&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30502&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30502&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30502&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30502&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30502&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30502&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30502&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30502&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30502&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30502&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30502&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30502&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30502&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30502&r=mysqlcfg