From: madcamel at gmail dot com Operating system: Linux, FreeBSD PHP version: 5.2.4 PHP Bug Type: CGI related Bug description: Status: header incorrect under FastCGI
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 bug report at http://bugs.php.net/?id=42848&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42848&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42848&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42848&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42848&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42848&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42848&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42848&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42848&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42848&r=support Expected behavior: http://bugs.php.net/fix.php?id=42848&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42848&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42848&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42848&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42848&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42848&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42848&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42848&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42848&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42848&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42848&r=mysqlcfg