Prestashop Tools :: getValue()函数不能转义sql注入?

Agn*_*Tom 2 php sql code-injection prestashop

我在prestashop论坛上看到该函数Tools::getValue()没有逃避sql注入.现在我想知道当我想获取字符串或int值时如何从sql注入中阻止此函数?

有人能告诉我一些例子吗?

The*_*rot 9

Tools::getValue() 仅检索POST或GET值.

要防止SQL注入,您可以使用pSQL()函数或int值,您可以进行类型转换.

 $int_val = (int)Tools::getValue('someValue');
 $string_val = pSQL(Tools::getValue('someValue'));
Run Code Online (Sandbox Code Playgroud)