Re: GET/POST array handling (was [PATCH] Deprecate use of stdio)
| From: | Rasmus Lerdorf | Date: | Sun, 04 May 2003 19:41:21 +0000 |
| Subject: | Re: GET/POST array handling (was [PATCH] Deprecate use of stdio) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1234@lists.php.net to get a copy of this message | ||
On Sun, 4 May 2003, Ilia A. wrote:
> On May 4, 2003 02:28 pm, you wrote:
> > On Sun, 4 May 2003, Ilia A. wrote:
> > > On May 4, 2003 02:13 pm, Rasmus Lerdorf wrote:
> > > > > Now, if we are dealing with arrays another questions comes to mind,
> > > > > if I have $_POST['abc']['xyz'] = 1 &
> > > > > $_POST['abc']['xyz] = 2 and I
> > > > > am already considering merging arrays, why shouldn't my
> > > > > $_REQUEST['abc']['xyz'] by array(1,2) ?
> > > >
> > > > It should, but right now that doesn't happen.
> > >
> > > Would that not present a BC break by itself as well?
> >
> > Well, before your patch $_REQUEST worked correctly actually.
>
> Here is a small patch, that makes $_REQUEST work properly once more. I am not
> certain about the performance implications of such a patch, but as far as
> functionality goes it does seem to do the trick.
This patch makes a mess of things. If you get data foo[a]=1 and post data
foo[a] = 2 then you end up with:
$_REQUEST
Array
(
[a] => Array
(
[0] => 2
[1] => 1
)
)
$_GET
Array
(
[a] => Array
(
[0] => 1
)
)
$_POST
Array
(
[a] => 2
)
That's definitely wrong.
$_REQUEST should only have foo[a]=2 if variables_order is "GP", $_GET
should only have foo[a]=1 and $_POST should only have foo[a]=2. Only
$_POST is correct with your patch.
-Rasmus