Does FILTER_VALIDATE_EMAIL make a string safe for insertion in database?

后端 未结 5 475
借酒劲吻你
借酒劲吻你 2020-12-11 19:35
$str = \'\"mynam@blabl\"@domanin.com\';

filter_var($str, FILTER_VALIDATE_EMAIL);//return valid email.

the above email returns true... Fair enough

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-11 19:50

    my question is if you validate an email using the above could an email carry sql injections that can harm the db even though you have filtered it with filter_var?

    filter_var is not a replacement for database specific sanitation like mysql_real_escape_string()! One needs to always apply that, too.

提交回复
热议问题