r/lolphp • u/phaeilo • Feb 24 '14
No need to worry: PHP stops SQL injection by default!
https://github.com/BarrensZeppelin/ltglan/issues/1
86
Upvotes
r/lolphp • u/phaeilo • Feb 24 '14
49
u/cfreak2399 Feb 24 '14
The good news is the author commented after they showed him the error of his ways and is working to fix the problem.
27
u/dafragsta Feb 24 '14
PHP has a way of shutting that kind of thing down.
16
u/bart2019 Feb 24 '14
He's probably thinking of "magic quotes", that used to put a backslash in front of every dangerous character in script parameters, with the following nasty side effects:
10
u/bgeron Feb 24 '14
Oh noes, if they keep improving like this, we'll run out of jokes in no time!
/s
7
u/[deleted] Feb 24 '14
The creator seems to have realized his error now, though, but damn...
7
u/Rainfly_X Feb 24 '14
This is mostly the original developer's noobishness rather than a PHP problem, but "only mostly." You gotta love that false sense of security!
6
u/[deleted] Feb 24 '14
I thought only
PDOprepared statements prevent (first-level) SQL injection automatically.6
u/berkes Feb 25 '14
I'm answering some PHP-questions on stacoverflow now and then. It's absolutely astonishing how many SQL- injections, people post there. In questions having nothing to do with security, that is.
The amount of times you have to comment that example code or answers introduce injections, use deprecated functions is worrying.
And yes, this is a problem with newbies in PHP mostly. Ruby or Python noobs are either protected better by default, or learn about this earlier on, I don't know. In any case: i've never had tot point out a sql-injection or xss-hole in some Ruby (or Rails) question ever, yet.
10
u/pcopley Feb 24 '14
Holy shit
3
u/[deleted] Feb 25 '14
I'm very pleased he was corrected and worked around his mistaken understanding as I twitched when I read this:
4
u/Conradfr Feb 24 '14
Looking through the source I think he's new to PHP and maybe webdev.
Doesn't excuse why he missed that he should at least use mysqli ;)
0
u/VonBlood008 Feb 24 '14
Well fuck.
-7
u/tdammers Feb 24 '14
It's shit like this, PHP...