#42969 [NEW]: header("Location:") changing HTTP status

From: Date: Mon, 15 Oct 2007 09:24:14 +0000
Subject: #42969 [NEW]: header("Location:") changing HTTP status
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118532@lists.php.net to get a copy of this message
From: gustav at cst dot co dot za Operating system: Windows Server 2003 PHP version: 5.2.4 PHP Bug Type: HTTP related Bug description: header("Location:") changing HTTP status Description: ------------ This bug is identical to bug #25044. When a form is posted to a PHP script, and that script wants to forward the browser to another page, the correct HTTP response header code is 303. But, when setting the "Location" HTTP header using the header() function, PHP automatically changes the HTTP response status to "302 Found". This is important because some mobile browsers (Specifically Motorola V360 and Nokia 6310i) will *not* immediately redirect a script that received a post when the code is 302, but *will* when the code is 303. I have recreated this problem on both IIS 6 and Apache. NOTE: The suggested workarounds in bug #25044 do *not* work. Reproduce code: --------------- <?php header('Status: 303 See Other'); header('Location: http://www.example.com/'); die(); ?> ---OR--- <?php header('HTTP/1.1 303 See Other'); header('Location: http://www.example.com/'); die(); ?> Expected result: ---------------- HTTP/1.1 303 See Other Location: http://www.example.com/ Actual result: -------------- HTTP/1.0 302 Moved Location: http://www.example.com/ -- Edit bug report at http://bugs.php.net/?id=42969&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42969&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42969&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42969&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42969&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42969&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42969&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42969&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42969&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42969&r=support Expected behavior: http://bugs.php.net/fix.php?id=42969&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42969&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42969&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42969&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42969&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42969&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42969&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42969&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42969&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42969&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42969&r=mysqlcfg

« previous php.bugs (#118532) next »