简体   繁体   中英

Prestashop Tools::getValue() function do not escape sql injection?

I read in prestashop forum that the function Tools::getValue() do not escape sql injection. Now I wonder how I can prevent this function from sql injection when I want to get string or int value?

Can somebody show me example?

Tools::getValue() only retrieves POST or GET value.

To prevent SQL injection you can use pSQL() function or for int values you can do typecasting.

 $int_val = (int)Tools::getValue('someValue');
 $string_val = pSQL(Tools::getValue('someValue'));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM