Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69457 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42343 invoked from network); 2 Oct 2013 16:10:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2013 16:10:04 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:58830] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/AA-23255-A554C425 for ; Wed, 02 Oct 2013 12:10:04 -0400 Received: from [192.168.2.20] (ppp-88-217-89-170.dynamic.mnet-online.de [88.217.89.170]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 46C16400BE; Wed, 2 Oct 2013 18:10:10 +0200 (CEST) To: Florian Anderiasch Cc: Daniel Lowrey , "internals@lists.php.net" In-Reply-To: <524C4006.9060106@anderiasch.de> References: <524C4006.9060106@anderiasch.de> Content-Type: text/plain; charset="UTF-8" Date: Wed, 02 Oct 2013 17:56:16 +0200 Message-ID: <1380729376.19591.26.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: HTTP supergloblas and request body/query (was: Parsing PUT data) From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Wed, 2013-10-02 at 17:47 +0200, Florian Anderiasch wrote: > On 02.10.2013 17:29, Daniel Lowrey wrote: > > The superglobals are a hopelessly poor abstraction. Can we stop trying to > > put the proverbial gold ring in the pig's snout on this? > > > > [...] > > > > Something like the following would be an infinitely superior solution: > > > > interface HttpRequest { > > function getMethod(); > > [...] > > } > > > > By adding a global function such as `get_request()` that returns the > > immutable request object you get all the functionality you could want: > > > > 1. Entity body parsing (for cookies or form data) could be done JIT > > 2. Userland code can easily typehint against the request > > 3. No more mutability, eminently testable > > 4. Eliminates the need for `$_GET`, `$_POST`, `$_COOKIE`, etc ... > > > > This is simply an example of a much better way to model HTTP requests -- > > it's not a suggestion for a final implementation. But IMO if we're going to > > fix this then we should really fix it and not continuously tickle the same > > broken abstraction. > > While I totally agree with your point, I don't see why this needs to be > in core. This is perfectly done in userspace, even the immutable part. > > The only benefit of putting that in core would be the standard-defining > part, but not much else. Plus it's not minimizing any abuse, as long as > the superglobals are still available (and I don't think renaming or > removing them would be a good idea. Also mind that filter_input() as an immutable API exists. johannes