Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69456 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40019 invoked from network); 2 Oct 2013 15:47:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2013 15:47:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ml@anderiasch.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ml@anderiasch.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain anderiasch.de from 81.169.138.148 cause and error) X-PHP-List-Original-Sender: ml@anderiasch.de X-Host-Fingerprint: 81.169.138.148 ares.art-core.org Received: from [81.169.138.148] ([81.169.138.148:53176] helo=ares.art-core.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CE/3A-23255-F004C425 for ; Wed, 02 Oct 2013 11:47:28 -0400 Received: from [192.168.178.20] (p5DE45D90.dip0.t-ipconnect.de [93.228.93.144]) by ares.art-core.org (mail.art-core.org) with ESMTPSA id 977792EE5C9; Wed, 2 Oct 2013 17:47:19 +0200 (CEST) Message-ID: <524C4006.9060106@anderiasch.de> Date: Wed, 02 Oct 2013 17:47:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Daniel Lowrey CC: "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: HTTP supergloblas and request body/query (was: Parsing PUT data) From: ml@anderiasch.de (Florian Anderiasch) 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. Greetings, Florian