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…
I don't get why people keep harping on super globals are being inherently bad. The variables are there. You can use them or ignore them. A variable definition harms you in no way other than a tiny bit of memory usage which is capped by the HTTP limit on POST and GET limits anyway. What? You think you're gonna get hacked because $_POST['ihaxyou'] is set to 'w00ts'? No one does this anymore: mysql_query("SELECT * FROM…
People do still write PHP like this, because they aren't even aware that SQL injection is a thing. I've seen it in code written relatively recently.
>Are you expecting it to be an integer? Easy >if(!ctype_digit($_POST['ID'])) { // throw exception here }
You forgot to check that the index "ID" exists first, that will throw a warning if it doesn't.
>Contrary to the hive mind you don't need some special encapsulation class to pull your post and get variables.
You don't need it,but encapsulation is still useful. You may want to use some source other than the superglobals, maybe for testing.
>What's with people expecting frameworks to do everything for them these days?
Frameworks are supposed to come with proper data validation out of the box - if they don't, they're bad frameworks.