Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81387 invoked from network); 14 Oct 2014 13:56:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2014 13:56:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=ben@benramsey.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ben@benramsey.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain benramsey.com from 209.85.192.54 cause and error) X-PHP-List-Original-Sender: ben@benramsey.com X-Host-Fingerprint: 209.85.192.54 mail-qg0-f54.google.com Received: from [209.85.192.54] ([209.85.192.54:52387] helo=mail-qg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/FB-26074-0AB2D345 for ; Tue, 14 Oct 2014 09:56:48 -0400 Received: by mail-qg0-f54.google.com with SMTP id z107so8184652qgd.41 for ; Tue, 14 Oct 2014 06:56:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=hLE0Zimx/wzmGSy/DktYUGod2r0e8BAiu5xKhM5dEkM=; b=ediSNIrvwqCQc7nd/2ygX09m3RXvqdKntPKrcQMb6O4IplSgaVGnIr99Hbx9+N4sUX 1Aw2ZLMvm5wFwp+JySilhez2dEzQX5FKVkd2/ufy34H2KqBCN9FSu+KDG/Kom3Wwx0s/ U5+6Is6l0soW29VqU0vbfzSeIN4wXVI1zZaG3HFLROve/+OzIJ5uwxjh2EeEWPOoji9d ULE8lPDxJH6snkIe/FVQvUkXb4sLoEy+JLLu/lUdH8njRrm4eCMVILwpkcWFdeP0dveb yTcNelSZci7mAlij1lEwjkzXRZ0wy6C0QKcXDM0iAhhm8JviZ0B/6OdUZT6Z4P89jgA5 ILjA== X-Gm-Message-State: ALoCoQlhGte2d1zNytqWyRjcCEOTjCO8nXMcfUA3jps6aqDNUFe6srk9i0KlUN4aodnXDFEaEuMm X-Received: by 10.140.43.6 with SMTP id d6mr8257145qga.104.1413295005940; Tue, 14 Oct 2014 06:56:45 -0700 (PDT) Received: from [10.0.0.70] (c-68-52-228-18.hsd1.tn.comcast.net. [68.52.228.18]) by mx.google.com with ESMTPSA id v16sm15507713qae.29.2014.10.14.06.56.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 06:56:45 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Tue, 14 Oct 2014 08:56:45 -0500 Cc: Andrea Faulds , Andrey Andreev , PHP internals list Content-Transfer-Encoding: quoted-printable Message-ID: <41B1F90F-8329-440B-9641-D0BC7DC2B3A6@benramsey.com> References: <776669CE-9E8C-4069-9834-C7275CCA0EF4@ajf.me> To: Kris Craig X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] New globals for PUT and DELETE From: ben@benramsey.com (Ben Ramsey) On Oct 14, 2014, at 8:42 AM, Kris Craig wrote: > Removing or renaming $_GET and $_POST would also create confusion and > almost certainly cause widespread BC breakage on a pretty massive = scale. > And there's really no gain to offset that. So that just leaves us = with > either continuing to have two REST methods but not the others or add a > $_PUT and a $_DELETE, even if they just alias to php://input again. There is no standard way to deal with the data in $_PUT and $_DELETE. In = fact, DELETE rarely, if ever, contains a request body. RFC 7231 (section = 4.3.5) says this about payloads within DELETE requests: A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request. There=92s no standard way to deal with the data in $_POST, either, = except that HTML forms send POST data by default as application/x-www-form-urlencoded, = making it easy for PHP to parse. When building RESTful APIs, that content type is = rarely used in favor of using JSON or XML content types, so even there the = $_POST super global in PHP is useless. You must still use php://input to get = the request body for those POST requests. While it might make sense to also include $_PUT, $_DELETE, $_PATCH, = etc., we would also need to build in parsers for a variety of content types, = and I don=92t think this is the job of the PHP engine to look at the content type on = every request and attempt to parse it in the way the developer expects it to be = parsed. That=92s much better left up to the developer, extensions, and libraries. Ben=