Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #42969 : header("Location:") changing HTTP status
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 12th August 06:23
php-bugs
External User
 
Posts: 1
Default #42969 : header("Location:") changing HTTP status



ID: 42969
Comment by: carsten_sttgt at gmx dot de
Reported By: gustav at cst dot co dot za
Status: Open
Bug Type: HTTP related
Operating System: Windows Server 2003
PHP Version: 5.2.4
New Comment:

According to the PHP manual for header(), you want use:
| header('Location: http://www.example.com/', true, 303);

Regards,
Carsten


Previous Comments:
------------------------------------------------------------------------

[2007-10-15 09:24:14] gustav at cst dot co dot za

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 this bug report at http://bugs.php.net/?id=42969&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666