【发布时间】:2014-11-10 12:30:57
【问题描述】:
我在控制台上收到以下错误:
<p>Severity: 8192</p>
<p>Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead</p>
<p>Filename: core/Security.php</p>
<p>Line Number: 512</p>
指的是核心/安全行 512 中的函数:
public function entity_decode($str, $charset='UTF-8'){
if (stristr($str, '&') === FALSE)
{
return $str;
}
$str = html_entity_decode($str, ENT_COMPAT, $charset);
$str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
}
发生这种情况是因为我将大量 HTML(纯 HTML)插入到数据库中。
public function add($data){
$this->security->xss_clean($data);
$this->db->insert('covers', $data);
return $this->db->insert_id();
}
如果我删除$this->security->xss_clean($data); 行,它会完美运行。
一个奇怪的事情是它可以在 Chrome 上运行,但是一旦我在 Firefox (v. 32.0.1) 上测试它就停止在 Chrome 上运行。在 Firefox 中测试并收到错误后,如果我转到 Chrome 并再次测试,我在 Chrome 中也遇到了同样的问题。
编辑:即使出现此错误,即使$this->security->xss_clean($data); 行打开,信息也会存储在数据库中,但警告会显示在控制台中。
【问题讨论】:
标签: php html codeigniter google-chrome firefox