#23454 [Ver->Csd]: Combining GET and POST array values is broken
| From: | iliaa@php.net | Date: | Tue, 13 May 2003 22:10:02 +0000 |
| Subject: | #23454 [Ver->Csd]: Combining GET and POST array values is broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-39566@lists.php.net to get a copy of this message | ||
ID: 23454
Updated by: iliaa@php.net
Reported By: oregon at pobox dot com
-Status: Verified
+Status: Closed
Bug Type: *General Issues
Operating System: ANY
PHP Version: 4.3.2RC3-dev
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-05-05 18:34:02] oregon at pobox dot com
If there's no way to have it both ways, I would recommend that when
setting register_globals=on, $_REQUEST and $GLOBALS should have the
correct combined result, even if that means $_GET, $_POST and $_COOKIE
also have all 3. But if register_globals=off, then let it should
continue to work as it does in 4.3 with the variables separated. That
would keep both register_globals=off and register_globals=on scripts
working correctly.
------------------------------------------------------------------------
[2003-05-05 17:53:44] rasmus@php.net
You should also mention that before 4.3.0 it was broken the other way.
The $_GET, $_POST and $_COOKIE arrays contained all 3 elements. Right
now the question is which way we want to break it. Do we want to
pollute GPC arrays with data from the other methods (potentially
overwriting data) or do we want to break BC and have it slightly more
correct but still have broken $_REQUEST and $GLOBALS. Ideally we want
it to be right for both, but I don't really see how to do that without
breaking the reference ties between the autoglobals.
------------------------------------------------------------------------
[2003-05-05 17:49:35] sniper@php.net
Expected results:
_GET: Array
(
[person] => Array
(
[age] => 27
)
)
_POST: Array
(
[person] => Array
(
[sname] => bar
)
)
_COOKIE: Array
(
[person] => Array
(
[fname] => foo
)
)
_REQUEST: Array
(
[person] => Array
(
[age] => 27
[fname] => foo
[sname] => bar
)
)
person: Array
(
[age] => 27
[fname] => foo
[sname] => bar
)
(the last two are broken since 4.3.0 and only contain
"fname" entry)
------------------------------------------------------------------------
[2003-05-05 17:43:42] sniper@php.net
Here's a bit more extended version of the test script,
including cookies too:
<?php setcookie("person[fname]", "foobar"); ?>
<form action="bug23454.php?person[age]=27" method=post>
<input type=text size=32 name="person[sname]">
<input type=submit>
</form>
<pre>
<?php
echo phpversion();
echo '<br>register_globals = ', ini_get('register_globals'),
'<br>';
print "_GET: "; print_r($_GET);
print "_POST: "; print_r($_POST);
print "_COOKIE: "; print_r($_COOKIE);
print "_REQUEST: "; print_r($_REQUEST);
print "person: "; print_r($person);
?>
</pre>
------------------------------------------------------------------------
[2003-05-02 18:40:57] philip@php.net
This might be related to closed bug #20796:
http://bugs.php.net/20796
Marking this one (#23454) critical as it makes autoglobals unreliable
and register_globals should work too. btw, track_vars doesn't exist
anymore, it's always on.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23454
--
Edit this bug report at http://bugs.php.net/?id=23454&edit=1