Re: New globals for PUT and DELETE
| From: | Mike Dugan | Date: | Tue, 14 Oct 2014 16:15:10 +0000 |
| Subject: | Re: New globals for PUT and DELETE | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78029@lists.php.net to get a copy of this message | ||
On October 14, 2014 at 11:57:26 AM, Rasmus Lerdorf (rasmus@lerdorf.com) wrote:
On 10/14/2014 06:29 AM, Andrea Faulds wrote:
>
> On 14 Oct 2014, at 14:27, Kristopher <kristopherwilson@gmail.com> wrote:
>
>> $_HTTP_REQUEST_BODY and $_HTTP_QUERY_STRING for nostalgia's sake.
>
> Ew, non-superglobals.
>
> But $_REQUEST_BODY and $_QUERY_STRING are a bit lengthy. Perhaps $_QUERY (for $_GET) and $_BODY
> (for $_POST)? Then the variable set finally makes sense, but isn’t too long:
>
> * $_QUERY - query string parameters
> * $_BODY - request body parameters
> * $_REQUEST - query string and request body parameters
>
> Makes more sense than $_GET and $_POST.
>
> Any objections?
It makes no sense to me to make $_BODY an alias for $_POST. $_POST
implies the default body encoding that a broswer performs on a POST
request. Making an alias called $_BODY that doesn't contain the body of
a request unless it is "POST"-encoded would be super confusing.
I think the pedantry level around this is rather high. Nobody is
actually confused about $_GET and $_POST and how and when to use them.
Adding vague aliases adds confusion to something that had no confusion
before.
-Rasmus
For clarity, $_BODY was revised to $_FORM.
I think there was some misunderstanding of the usage of $_GET earlier in this thread, although I may
have misunderstood someone’s wording. Regardless, if I go out and sample 100 PHP folks, I’m
fairly confident someone would make the association that either $_GET or $_POST is bound strictly to
the HTTP verb of the same name. Adding aliases gives these vars a more semantic name while not
causing a massive BC breakage.
The documentation would be simple and not have room for misinterpretation as I see it:
$_FORM is the exact same by-reference variable as $_POST
$_QUERY is the exact same by-reference variable as $_GET
--
Mike Dugan
mike@mjdugan.com