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:
> If it works on your setup, I'd be very interested in finding out
> how/why. Have you tested it?
Sure:
| C:\php>php -v
| PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31)
|
| C:\php>type C:\www\htdocs\test.php
| <?php header('Location: http://www.example.com/', true, 303); ?>
|
| C:\php>GET -S -m head http://localhost/test.php
| HEAD http://localhost/test.php --> 303 See Other
| HEAD http://www.example.com/ --> 200 OK
| Connection: close
|
|
| C:\php>
Regards,
Carsten
Previous Comments:
------------------------------------------------------------------------
[2007-10-18 08:12:38] gustav at cst dot co dot za
Hi,
I tested that variation of the code before I made my bug report. Alas,
it still doesn't work.
If it works on your setup, I'd be very interested in finding out
how/why. Have you tested it?
Regards,
Gustav
------------------------------------------------------------------------
[2007-10-18 02:04:12] carsten_sttgt at gmx dot de
According to the PHP manual for header(), you want use:
| header('Location: http://www.example.com/', true, 303);
Regards,
Carsten
------------------------------------------------------------------------
[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