Earlier quoted context omitted.
My company does penetration testing and most of the projects involve web apps. Our clients use PHP, J2EE and .NET, and after 7 years of operation, we clearly see a trend where the number and severity of security issues are highest in PHP apps, lowest for .NET, with J2EE in the middle. Of course, there's the odd secure PHP app and the .NET project with gaping holes, but the trend is obvious. So it's not peer pressure,…
Please tell me more about these PHP projects, if you have the data available to you. * Did they support EOL'd versions of PHP? * Are they legacy WordPress/Drupal/Joomla projects that haven't been updated in years? * Are they in the "we (didn't use a framework|rolled our own framework) and used the mysql_* functions" league? * Did they attempt to do something weird/crazy (i.e. store all session state in an encrypted c…
Frameworks were sometimes used, although their effect on security is somewhat baffling at first sight -- and this is regardless of the platform, although we found most issues with PHP and J2EE. Sure, when you use the framework for security-critical things such as constructing SQL queries (SQLi) or HTML output (XSS), things work quite well. However, since most developers don't think about these issues, the single time they have to "escape" from the framework, since it doesn't (or they just think it doesn't) support a certain scenario, they don't know about all the things PHP and in smaller ways, J2EE requires to do for security.
Of course, this way, the framework protects 9x% of the application, but the asymmetry of security is that the attacker only needs a single vulnerability while the defender must patch it all.