(no title)
uriel | 14 years ago
The number of pitfalls and traps you can fall into almost surpasses the 'safe' parts of the language (and its environment).
uriel | 14 years ago
The number of pitfalls and traps you can fall into almost surpasses the 'safe' parts of the language (and its environment).
FuzzyDunlop|14 years ago
The huge vulnerability that opens up is that of data validation, and you can tighten up your server config all you want, but it won't mean shit without any of that.
Of course, since PHP is such a comparatively simple language, everyone thinks they're an expert once they know how to open a mysql connection (through the now deprecated bindings, of course) and code a simple blog script with basic CRUD functionality.
As a result, there's a 'simple/complicated' dichotomy when it comes to online documentation and tutorials, where the beginner developer ignores the complicated (and typically well thought-out) stuff, and goes for what they can easily copy and paste or get their head around.
Typically none of that code has any sort of validation or sanitisation. Half of it might go on about `magic_quotes_gpc` and `mysql_real_escape_string` and other PHP4-tastic curios, and the rest won't even mention that because checking user input is seemingly only related to db communication.
I feel pretty strongly about it because I've seen people post code snippets for PHP, trying to be helpful, but the code is dangerous. They serve better as examples of exactly what you shouldn't do.
And the one thing PHP beginners (and intermediates) need is better, simpler explanations of responsible coding practices, and how it isn't hard to do at all (it's only tedious); because the sooner they know, the better.
I should write a book or something.
jasonlotito|14 years ago
Honestly, I feel there are a large number of quality sources for writing good PHP code. The problem is that isn't not all focused on PHP.
"everyone thinks they're an expert once they know how to open a mysql connection"
How true.
PHP is deceptively easy. It's akin to C, in that it will allow you to shoot your own foot if you ask it.
maratd|14 years ago
> Except that building a "properly written PHP app" is way harder than in almost every other language in widespread use.
This makes no sense. PHP doesn't force you to do things the right way, but it doesn't force you to do things the wrong way either. It just doesn't force you either way.
Those of us who know what we're doing can make intelligent decisions ... and those of us who can't, shouldn't be writing in PHP.
FuzzyDunlop|14 years ago
To be dismissive of those who 'don't know what they're doing' doesn't necessarily help make those intelligent decisions better known and easier to understand, or why they're the intelligent decisions in the first place.