Bug #70028 [Opn->Fbk]: $_POST data being automatically filtered.
| From: | cmb@php.net | Date: | Wed, 08 Jul 2015 19:22:43 +0000 |
| Subject: | Bug #70028 [Opn->Fbk]: $_POST data being automatically filtered. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194226@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70028&edit=1
ID: 70028
Updated by: cmb@php.net
Reported by: treboralmasy1 at gmail dot com
Summary: $_POST data being automatically filtered.
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
PHP Version: 5.6.10
Block user comment: N
Private report: N
New Comment:
I'm not able to reproduce the described behavior with the
following self contained test script (PHP 5.6.10, built-in
webserver):
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
var_dump($_POST);
var_dump(file_get_contents('php://input'));
}
?>
<form action="<?=$_SERVER['PHP_SELF']?>"
method="POST">
<input type="text" name="username">
<input type="submit" value="click">
</form>
Which SAPI do you use?
Previous Comments:
------------------------------------------------------------------------
[2015-07-08 17:17:40] treboralmasy1 at gmail dot com
Description:
------------
When a form is submitted with an empty value $_POST does not add an empty key. Instead it
automatically filters it. If data is entered $_POST behaves like normal (populates key and value).
Ie: when no code is entered:
file_get_contents('php://input'):
username=
$_POST:
array()
when username IS entered:
file_get_contents('php://input'):
username=test
$_POST:
array( username=>test)
Test script:
---------------
<form action="" method="POST">
<input type="text" name="username" />
<input type="submit" value="click">
</form>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70028&edit=1