News for hackers. Stuff that matters.
Re:PHP 7 deployment at Dailymotion by Aaargh20318 on Friday October 14, 2016 @09:09AM (#12707795)
> There's absolutely NOTHING wrong with having $_POST['whatever'] inside a controller as long as you're doing proper checks.

The last part is why this is a problem.

The truth is that programming is simply too difficult a task for human beings. Software is so complicated with so many moving parts that it is impossible for anyone to understand all the details of even the simplest piece of code. This is why we have operating systems, programming languages, and frameworks. Or more generally: this is why we have abstractions and tools: to make it possible for humans to actually write somewhat functional software.

This is also why you not only want languages, frameworks and tools that let you do the right thing; you want them to prevent you from doing the wrong thing. You want to reduce the number of things you have to think about to the absolute minimum, simply because no one is smart enough to fully understand everything that's going on. That is why you want things like strongly typed languages.

Sure, you can make something that works and is safe, if you make no mistakes. The point is that we want to take the human ability to make mistakes out of the equation as much as possible. Sometimes it is inevitable because of what a language, framework or tool is used for. In the case of PHP there are a lot of ways to shoot yourself in the foot that do not need to exist in a high-level language such as PHP, and that is the reason why PHP sucks and is a bad idea. It is way more fragile than it has a need to be.

Re:PHP 7 deployment at Dailymotion by wwweston on Friday October 14, 2016 @01:10PM (#12709514)
> The last part is why this is a problem.

$_POST isn't the problem. The scope of the variable isn't the problem. You've realized this, too, and that's why you're shifting the argument to one about typing instead of superglobals-are-bad (typing and scope are obviously independent features).

> You want to reduce the number of things you have to think about to the absolute minimum

The net effect of type systems seems to actually be to force you to think about a larger number of things very very carefully. The only thing that ends up being reduced is having to think about having to think about them.

Re:PHP 7 deployment at Dailymotion by nilliams on Friday October 14, 2016 @04:46PM (#12710975)
Parent did not 'shift the argument to one about typing instead of superglobals-are-bad' as I read it.

They said superglobals are bad because they make it too easy to do the wrong thing.

And the followup was about how often people do the wrong thing.

If you interpreted that any other way you misread (afaict).

Re:PHP 7 deployment at Dailymotion by Aaargh20318 on Saturday October 15, 2016 @04:55AM (#12713294)
>> The last part is why this is a problem.

> $_POST isn't the problem

No, it isn't. That's why I specifically said "The last part is the problem", referring to "as long as you're doing proper checks."

Specifically, my point is that you should not rely on people 'doing the proper checks' because people make mistakes, thus you want to reduce the amount of situations where people are given the opportunity to make those mistakes.

There are a lot of situations in PHP where you need to 'do the proper checks' for no reason other than bad language design, and that is what makes PHP a bad language.

Re:PHP 7 deployment at Dailymotion by berdario on Friday October 14, 2016 @02:50PM (#12710262)
> typing and scope are obviously independent features

You might want to read about effect systems

http://rtpg.co/2016/07/20/supercharged-types.html

(it might not be the best blog post on the subject theory, but I think it's a nice practical example)