Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69476 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20313 invoked from network); 3 Oct 2013 09:18:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2013 09:18:18 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.49 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.215.49 mail-la0-f49.google.com Received: from [209.85.215.49] ([209.85.215.49:47456] helo=mail-la0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/70-18027-9563D425 for ; Thu, 03 Oct 2013 05:18:17 -0400 Received: by mail-la0-f49.google.com with SMTP id ev20so1650228lab.22 for ; Thu, 03 Oct 2013 02:18:14 -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; bh=/I1o3CU0HBEoRrAoA2+efwRGYWiXkt5wataGn6/o9H8=; b=LLO0DGKn+1o9mPhNe1ZDkyoQLwmLLYskAZGCCHxz1hwN/aLNc6i5iG7Uwj7HfbcJgu pdeLYB8hkbT8sb5/eag1UKEvBhWirH3Ks4UALhgilXCkvT8OIx06uY7pLrmPk2kY/FeN 7gpuIzXpteJm5BKhG8Tmksst4SVYCxAeXbEEiATzeKasNhbpW+ivZu4RDKpdFnRQHxY3 m16Dv+jrRw8sybJd479gSYnO/BfwCQYZNzI/se3Me4jQsg8R0HCnKS0F06rbsEvdQfaz GpSFVEr2/azqNBOH1zDdzq5S5cDxHlwfOHBEkGO+OYSMzQF1hzvvgT0XqP4+MKjfgxEU kwbw== MIME-Version: 1.0 X-Received: by 10.112.161.105 with SMTP id xr9mr711469lbb.40.1380791894529; Thu, 03 Oct 2013 02:18:14 -0700 (PDT) Received: by 10.112.148.138 with HTTP; Thu, 3 Oct 2013 02:18:14 -0700 (PDT) In-Reply-To: References: Date: Thu, 3 Oct 2013 02:18:14 -0700 Message-ID: To: Nikita Popov Cc: Michael Wallner , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] HTTP supergloblas and request body/query (was: Parsing PUT data) From: pierre.php@gmail.com (Pierre Joye) hi! On Wed, Oct 2, 2013 at 8:15 AM, Nikita Popov wrote: > On Wed, Oct 2, 2013 at 8:59 AM, Michael Wallner wrote: > >> Since ever people are confused by _GET and _POST superglobals, >> because, despite their name, they do not (really) depend on the >> request method. Therefor I propose to phase out $_GET and name it >> $_QUERY and I propose to phase out $_POST and name it $_FORM (I'm not >> 100% confident with the latter yet, though). >> > > I don't think this kind of change is worth it if you just rename two very > heavily used variables. If something in this direction is changed the > change should be more thorough (including getting away from superglobals > and representing the request state by an immutable object). I totally agree with you here. Unlike the other related changes, the impact on existing code is much larger here, for little gain. I am in favor of not touching them, at all. >> There are already parsers for application/x-www-form-urlencoded and >> multipart/form-data in the core. One could think of providing an API >> to add content type handlers from extensions, ext/json may be an >> example, like it is hacked into pecl_http-v2. >> > > I would *strongly* recommend against adding additional body parsers that > are automatically invoked based on the content type. Again, I totally agree. > Adding additional > parsers creates a high security risk. E.g. exposing ext/json as it is now > would open you to a denial of service attack (if I'm not mistaken). There > has been a long history of security vulnerabilities (both DOS and RCE) > related to unnecessary or incorrect exposure of request body parsers. A > prominent recent example are the RCE vulnerabilities in Rails caused by the > exposure of YAML and JSON parsers. However I could imagine some new ways to deal with inputs, rest/http/services friendlier. But it is a tricky area, both from an API design and security points of view. Cheers, -- Pierre @pierrejoye | http://www.libgd.org