Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76612 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51842 invoked from network); 17 Aug 2014 20:14:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2014 20:14:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=park.framework@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=park.framework@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.50 as permitted sender) X-PHP-List-Original-Sender: park.framework@gmail.com X-Host-Fingerprint: 209.85.219.50 mail-oa0-f50.google.com Received: from [209.85.219.50] ([209.85.219.50:53997] helo=mail-oa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/D2-28428-03D01F35 for ; Sun, 17 Aug 2014 16:14:41 -0400 Received: by mail-oa0-f50.google.com with SMTP id g18so3428469oah.37 for ; Sun, 17 Aug 2014 13:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Lj3+C0+dydrELeWOLEpKuSuQC9nVVJDy7E5KvEdokN8=; b=B/G4araue44FrDWiptU9A+moK6Wrp9v4LGx1eAgBe7F3WcIGssYYBIaDpe4mTPT9z/ xzDNv+TboIGXdCxw6ZWzz30jOXT9/9H1Leze+weAgGjXFuegn8JIFoUB/XxxPbwovkEg mbGKeEPEm1w+GHcWyz/XO5cjmijylYR8FPltYYQqEnb2RdToFtJP2og8ZuOG061y655k C4lGA8iCJb29HKs9NBDCZji7rd0ihyEBXbwRn1P+TLtgXKZF5p+RoH3eFffXhYQELhAh KRvJapCtmb4NeEX/K7T3G1AIO4H8WOYaPhmNqVSlDq7TOd210/SHWj3+cSDpFkOYqvpq jVsA== MIME-Version: 1.0 X-Received: by 10.182.19.135 with SMTP id f7mr33159656obe.40.1408306478082; Sun, 17 Aug 2014 13:14:38 -0700 (PDT) Received: by 10.76.23.37 with HTTP; Sun, 17 Aug 2014 13:14:38 -0700 (PDT) In-Reply-To: <7F9FDADD-FA96-45AD-9D72-8D79A8B86948@ajf.me> References: <7F9FDADD-FA96-45AD-9D72-8D79A8B86948@ajf.me> Date: Sun, 17 Aug 2014 23:14:38 +0300 Message-ID: To: Andrea Faulds Cc: Chris Wright , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Native support - PUT request, multipart form data From: park.framework@gmail.com (Park Framework) As a variant, not to create a new super global variables, can be modified $_REQUEST to OOP style class _REQUEST implements ArrayAccess // for backward compatibility { .... } // get as array, from body request $_REQUEST->body // get all http request headers $_REQUEST->headers // get method request - POST, PUT... $_REQUEST->method // get Content-Type: multipart/form-data or application/json or ... $_REQUEST->type // get Content-Length request $_REQUEST->length It looks nice, but in practice it is more convenient to use an global array - $_DATA or $_BODY or $_INPUT. You can also do: class _INPUT implements ArrayAccess { public function get($name, $default =3D null) { if(isset($this->data[$name]) { return $this->data[$name]; } else { return $default; } } public function filter($name, $filter =3D FILTER_DEFAULT, $options =3D nu= ll) { return filter_var($this->data[$name], $filter, $options); } } Examples: $value =3D $_INPUT->get('varName1', 'myDefaultValue'); $email =3D $_INPUT->filter('varName2', FILTER_SANITIZE_EMAIL); 2014-08-17 3:25 GMT+03:00 Andrea Faulds : > > On 17 Aug 2014, at 00:47, Park Framework wrote= : > >> Variable $_PUT is already a popular name. > > $_POST isn=E2=80=99t really POST data nor is $_GET really GET data. We sh= ouldn=E2=80=99t continue this silly naming tradition given both existing na= mes are inaccurate. > > We should have a query parameters array and a request body parameters arr= ay or blob. > -- > Andrea Faulds > http://ajf.me/ > > > >