ID: 42848
User updated by: madcamel at gmail dot com
Reported By: madcamel at gmail dot com
Status: Open
Bug Type: CGI related
Operating System: Linux, FreeBSD
PHP Version: 5.2.4
New Comment:
404 behavior:
$ php-fcgi does-not-exist.php
Status: 404
Content-type: text/html
Expected: "Status: 404 Not Found"
Previous Comments:
------------------------------------------------------------------------
[2007-10-04 04:41:30] madcamel at gmail dot com
Description:
------------
When PHP is used as a FastCGI it outputs incorrect Status: headers.
For example, a redirect triggered by header("Location: http://x.com/")
returns "Status: 302", not "Status: 302 Moved Temporarily" as is
explicitly required by the FastCGI specification.
This leads to most web servers returning "HTTP/1.1 302" instead of
"HTTP/1.1 302 Moved Temporarily", thereby breaking some very picky
browsers.
This problem also also occurs with 404 if a PHP file could not be
found, and I'm sure every other type of "Special" response. This makes
it different than bug 41738.
Related bugs:
http://bugs.php.net/bug.php?id=41378
http://bugs.php.net/bug.php?id=31065
http://bugs.php.net/bug.php?id=36705
Reproduce code:
---------------
--- Test 1
<?php
header("HTTP/1.1 302 Moved Permanently");
header("Location: http://www.google.com/");
?>
$ php-fcgi fun.php
Status: 302
Location: http://www.google.com/
Content-type: text/html
--- Test 2
<?php
header("Location: http://www.google.com/");
?>
$ php-fcgi fun.php
Status: 302
Location: http://www.google.com/
Content-type: text/html
--- Test 3
<?php
header("Status: 302 Moved Temporarily");
header("Location: http://www.google.com/");
?>
$ php-fcgi fun.php
Status: 302
Status: 302 Moved Temporarily
Location: http://www.google.com/
Content-type: text/html
Note the duplicate "Status:" headers, which is dissallowed by the
FastCGI spec.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42848&edit=1