【发布时间】:2010-06-30 23:20:16
【问题描述】:
如果我为 mysql 注入进行序列化,是否需要转义我的对象数据?
即:
class Object
{
public $description;
}
$obj = new Object();
$obj->description = mysql_real_escape_string("this is my crazy string with lot's of bad // characters");
$data = serialize($obj); // <-- $data will be stored in DB
或者这样就足够了:
class Object
{
public $description;
}
$obj = new Object();
$obj->description = "this is my crazy string with lot's of bad // characters";
$data = serialize($obj);
【问题讨论】:
-
FWIW,“很多”中不应该有撇号,所以无论如何它是安全的。 (开个玩笑!)
-
@Bill 哈哈。那真好笑。我想不出要写什么。所以,你抓住了我;)
标签: php mysql serialization