#33661 [Fbk]: Header and _POST problem
| From: | rasmus@php.net | Date: | Tue, 12 Jul 2005 14:03:38 +0000 |
| Subject: | #33661 [Fbk]: Header and _POST problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81745@lists.php.net to get a copy of this message | ||
ID: 33661
Updated by: rasmus@php.net
Reported By: f dot hardy at origami-systems dot com
Status: Feedback
Bug Type: HTTP related
Operating System: freebsd 4.10
PHP Version: 5.0.4
New Comment:
Are you sure? I tested your code under both PHP 4.4 and 5.1 and it
works nicely. With a request like:
POST /abc.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;
rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/abc.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 19
test=&modify=Modify
I get back:
HTTP/1.x 404 Not Found
Date: Tue, 12 Jul 2005 13:59:21 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) PHP/5.1.0-dev
X-Powered-By: PHP/5.1.0-dev
Content-Type: text/html; charset=utf-8
Keep-Alive: timeout=1, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Of course, there is no body to the 404 response, because you are not
sending any. So how exactly did you check that you were getting a 200
back on the POST request?
Previous Comments:
------------------------------------------------------------------------
[2005-07-12 15:38:58] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-07-12 15:33:03] f dot hardy at origami-systems dot com
Description:
------------
I have a problem with $_POST and the header() function.
If I make a test on $_POST, my 404 http header is replaced by a 2OO OK
header.
If I make a test on $_GET (with a get action in html form), or an
another variable, I receive the 404 http header.
Reproduce code:
---------------
<?php
if (isset($_POST['test']) == true)
{
header("HTTP/1.1 404 Not Found", true);
die();
}
else
{
?>
<form method="post">
<input type="text" name="test" value="" />
<input type="submit" name="modify" value="Modify" />
</form>
<?php
}
?>
Expected result:
----------------
A 404 HTTP header in response.
Actual result:
--------------
A 200 OK HTTP header in response.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33661&edit=1