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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php