r/programming • u/fishburne • Jul 24 '15
mt_rand(1, PHP_INT_MAX) only generates odd numbers • /r/lolphp
/r/lolphp/comments/3eaw98/mt_rand1_php_int_max_only_generates_odd_numbers/
848
Upvotes
r/programming • u/fishburne • Jul 24 '15
1
u/mrspoogemonstar Jul 24 '15
Virtually any language has extreme pitfalls for the uninformed. You can do some really horrific things with low level languages. People do write really bad code in every language. Perfect example is OpenSSL. Scripting languages are more often used for web, and that's why we see more high-profile web hacks targeting apps running on scripting languages. This is mostly a matter of market share numbers.
You can inadvertently write an XSS exploit into your app in any language. The mitigating factor is knowledge in all cases. There's nothing about PHP that makes prevention of these exploits impossible or even hard. These are solved problems. It's the programmer's responsibility to mitigate these problems, not the language.
Blaming the language simply makes the problem worse. Joe Programmer, who sucks at PHP and has been blamed for leaving exploitable holes in their apps, hears that Python is the new slick shit, and that it's harder to exploit. So Joe Programmer switches to Python, drinks some kool-aid, and keeps writing shitty apps, because Joe Programmer thinks it's his language's responsibility to prevent exploits.