On Tue, Oct 14, 2014 at 1:21 PM, Rasmus Lerdorf <ras...@lerdorf.com> wrote:

> On 10/14/2014 11:16 AM, Rowan Collins wrote:
> > On 14/10/2014 17:18, Rasmus Lerdorf wrote:
> >> I think 20+ years of history has proven this to be a non-issue. Of all
> >> the things that people get confused by in PHP, $_GET/$_POST are right
> >> near the bottom of the list.
> >
> > The popularity of REST is what has changed this. Until people started
> > writing RESTful APIs, only two HTTP request types were in common use.
> > Nobody was confused about where PUT method data would end up, because
> > nobody processed any PUT methods.
> >
> >> 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.
> >
> > The encoding has no relationship with the request type, even in browsers
> > - the default encoding of a POST form is actually the same encoding used
> > to produce a URL form a GET form.
>
> Sure, but $_GET/$_POST do. They were not named to match HTTP primitives.
> They were named to match form methods. As in form method="get" and
> method="post". And here the default encoding the browsers use for these
> two methods definitely matter.
>
> -Rasmus
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I understand that that was the original intent. However, the use cases have
expanded beyond simply handling HTML form submissions.  People are writing
REST APIs using PHP now, and having GET/POST but not PUT/DELETE has indeed
led to confusion.  I only posted this after doing a Google search and
finding tons of results from people mistakenly asking why PHP doesn't
handle PUT/DELETE requests or complaining how the lack of aliases for
PUT/DELETE leads to inconsistency in the code.

Personally, I like the idea of using more appropriately named aliases,
particularly if they're roughly the same number of characters.  However, we
would need to allow at least several years for people to adopt the new
globals before deprecating $_GET and $_POST.  Ultimately, they will either
need to be deprecated or the $_PUT and $_DELETE aliases will need to be
added, otherwise the issue I raised would remain unresolved.

--Kris

Reply via email to