Neglecting to validate user input is akin to foregoing any defensive gameplan for containing the NFL’s leading rusher. Chances are sooner or later you’re going to get run over. Yet even in spite of the dire ramifications of doing otherwise, many developers choose to ignore the potential problems presented by user input, reasoning that data validation is tedious and distracts them from the larger goal of building a working application. The result? Corrupt and incorrect data, cross-site scripting and SQL injection attacks, and a giant headache come Monday morning.
There really is no way around it anymore: you must validate user input within every web application. However, because data validation is a task faced by all developers, and it follows a fairly rigorous specification regardless of where its ultimately applied, the task seems suitable for automation by a framework. CakePHP does exactly this, going a long way towards making data validation a snap.
In the second installment of this occasional Developer.com series on this powerful framework, I’d like to show you another way frameworks can make your life easier by demonstrating CakePHP’s data validation capabilities.
