Re: GET/POST array handling (was [PATCH] Deprecate use of stdio)
| From: | Ilia A. | Date: | Sun, 04 May 2003 18:08:03 +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-1225@lists.php.net to get a copy of this message | ||
On May 4, 2003 01:53 pm, Rasmus Lerdorf wrote:
> On Sun, 4 May 2003, Ilia A. wrote:
> > IMO when the same variable is passed via GPC methods we should follow the
> > GPC order specified in the config and overwrite variables even if they
> > are arrays that if merged could potentially have stored both GET & POST
> > data. The reason is that when merged, it is impossible to tell where the
> > data had come from, unless the user begins to use the $_GET & $_POST
> > auto-globals, which they should have been using in the 1st place.
>
> That's fine, but that's a nasty BC break. That's not how it has worked in
> the past. It may be the only sensible way to solve this though. Don't
> forget that $_REQUEST is affected by this as well.
It's a BC break, true, just how nasty is it and how many people are adversly
affected by it I do not know. To me it appears like a rather 'iffy' behavior
to rely upon in the 1st place. That said, imho the adverse affects displayed
in bug #20796 are far more dangerous (?) then the ones in #23454.
If we were to consider a proper fix, we would need to:
1) do is_array on every array element recursively, since there is nothing to
say user won't have a[1][2][3][4][5][etc..].
2) If we find a duplicate key we need to check the values and insert if
different, however we cannot make a reference to the original so an actual
copy would be needed.
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) ?
Ilia