Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77983 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53740 invoked from network); 14 Oct 2014 13:23:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2014 13:23:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.218.45 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.218.45 mail-oi0-f45.google.com Received: from [209.85.218.45] ([209.85.218.45:65412] helo=mail-oi0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/95-26074-FB32D345 for ; Tue, 14 Oct 2014 09:23:14 -0400 Received: by mail-oi0-f45.google.com with SMTP id i138so16494259oig.18 for ; Tue, 14 Oct 2014 06:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xYeIgkVEL8NS1LFcET3xHsOQZ42iHrTgXNyrCm8+sRA=; b=WfLJC/8vOZbmpyxfoW3wWPyJ4aHo2kzJgUlYzFtUQATEPpIdrAB0MIr4QNclcKe2gV FUuNGWhNVtxDQTnlHfGSHaBc95jTdr0J7B01aj4euwQntp6yLVhhdNVXQNnmwu3mLUH6 hkBy7StL4lQIkKzvPR7aWlRJhBw7PPM5FZ99c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=xYeIgkVEL8NS1LFcET3xHsOQZ42iHrTgXNyrCm8+sRA=; b=RF4a7CJ0H9ISImTuAWYTlpuOPSmQAgenuwqjz9wkAd3zGhD3S1YgepmN3nnNkUPIyf aFct+gAC5aGATND+MBjjsZPg785wS+BC5fGL+TF+OcPkUjU19p1O88oEnac915z9rgRK mFhbwPSYrUedFa5+Kj945Zia6GMbx6+/9NjG99DMHPkdH5N2Ovfk38pCjb8EaR3L3mZx rl4J1aKQZC69CLzrSfIUXGpROyqwnPdt1gRFQ1iVU3OcOvvN3Udmt+NYnDFWUvC21668 jXObDqrtycx+fjbNiv8RuMV3OupwOLJ7t0AfZ2+ijZQ+V1zHCVLLU7xwG3JpV2pO2V6a i+Xg== X-Gm-Message-State: ALoCoQkptjiQZpYIMHahgXAj19N3uH+2iNcQlUKszSnYO7wQZj2dSWGEFv2qd4aNDuErDMcwtAA7 MIME-Version: 1.0 X-Received: by 10.182.126.40 with SMTP id mv8mr2546762obb.44.1413292989615; Tue, 14 Oct 2014 06:23:09 -0700 (PDT) Received: by 10.202.75.71 with HTTP; Tue, 14 Oct 2014 06:23:09 -0700 (PDT) In-Reply-To: References: <776669CE-9E8C-4069-9834-C7275CCA0EF4@ajf.me> Date: Tue, 14 Oct 2014 16:23:09 +0300 Message-ID: To: Kris Craig Cc: Andrea Faulds , PHP internals list Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] New globals for PUT and DELETE From: narf@devilix.net (Andrey Andreev) On Tue, Oct 14, 2014 at 4:09 PM, Kris Craig wrote: > On Tue, Oct 14, 2014 at 5:54 AM, Andrea Faulds wrote: > >> >> On 14 Oct 2014, at 13:47, Kris Craig wrote: >> >> > Hey guys, >> > >> > Does anybody know why we have $_GET and $_POST, but not $_PUT and >> > $_DELETE? As far as I can tell, the only way to get these out currently >> is >> > to parse their values by reading the incoming stream directly. >> > >> > Is there a reason why we don't want this or is it just that nobody has >> > actually written it yet? >> >> $_GET and $_POST are really misnomers. $_GET is query string parameters, >> $_POST is request body data. >> >> We should just put the request bodies for all requests, not just POST, >> into $_POST. >> >> -- >> Andrea Faulds >> http://ajf.me/ >> >> > The problem with that approach though is that it would not be RESTful. I'm > developing a REST API (with the goal of 100% REST compliance) and having > PUT/DELETE variables mixed in with $_POST would not only be > counter-intuitive, but it would just present a new roadblock. > Incorporating GET in there, as well, would make things even worse. > > Basically, if we have $_GET and $_POST, then we should also have $_PUT and > $_DELETE. Either that, or they should all be tossed. There's no reason > why $_PUT and $_DELETE should not also exist. > > --Kris This has nothing to do with REST. $_GET doesn't even relate to GET requests, it's just query parameters. Query parameters exist in all types of requests because they are part of the URI. $_POST (even if only parsed for POST requests) also represents just the request body parsed from a very specific format. There's no reason to have $_PUT, $_DELETE, etc. because they would represent the same thing - php://input parsed from application/x-www-form-urlencoded. That being said, from a purely semantic prospective, both $_GET and $_POST should be tossed - yes. In reality, you can't do that because virtually all PHP applications use them. But this is no reason to add even more global vars with such misleading ... meanings. What would be nice is to be able to register userland parsers into a "request body parser" of some kind, so that you can have automatic parsing depending on the Content-Type header. Cheers, Andrey.