Hack and HHVM solves what is, IMO, the worst feature of the default PHP runtime environment[0] - and that is the superglobals. It wasn't mentioned in the post from Slack, but default superglobals and the earlier register_globals design decisions are the worst and most impactful wart in PHP. Because it was designed as a templating language, the default web server interface, which is CGI - will auto-expose all variable…
The fact that their "recipe" relies on one file being run in "non-strict" mode for it to work at all is very telling about how short-sighted this "vision" to remove superglobals is.
Even if you went the whole hog, and removed $_GET, $_POST etc. You force users to use filter_input() to get variables. (Why doesn't the Hack "recipe" do this anyway?)
Now tell me how you access a a structured POST body. e.g.
foo[bar]=baz&foo[baz]=bar
Oh. Right, you can't. Because filter_input only returns scalars.If you remove $_GET and $_POST people will just do the equivalent in the new construct:
$query = "SELECT * FROM username_list WHERE username='" . filter_input(INPUT_POST, 'username') . "'";
$query = "SELECT * FROM username_list WHERE username='" . $myFancyPostObject->getString('username') . "'";
The PHP developers who understand why using raw untrusted input is dangerous are already using the facilities provided to make the input safe for use, in some cases built around access to $_GET and $_POST.The PHP developers who are already using raw untrusted input in dangerous ways will simply find new dangerous ways to use the data.