samuel89 Posted March 16, 2014 Share Posted March 16, 2014 Prestashop taught in http://www.prestashop.com/forums/forum/116-development/ that All user's data (data entered by users) has to be cast. Example: $data = Tools::getValue('name'); $myObject->street_number = (int)Tools::getValue('street_number'); The 1st example is not casted. Why? Thanks. Link to comment Share on other sites More sharing options...
math_php Posted March 18, 2014 Share Posted March 18, 2014 Hi, Because casting a string will give you the same string. 'Name' should be validated with regex. Cast is usefull especially for numeric values. Regards Link to comment Share on other sites More sharing options...
samuel89 Posted March 18, 2014 Author Share Posted March 18, 2014 Thanks for your reply. Is there an example regarding the regex validation you were talking about? Thanks. Link to comment Share on other sites More sharing options...
math_php Posted March 18, 2014 Share Posted March 18, 2014 For sure look at the class Validate. Examples : $bool_resp = Validate::isName($name) $bool_resp = Validate::isCatalogName($name) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now