Easy Google Syntax Highlighter插件的设置页面错误

Easy Google Syntax Highlighter插件在Wordpress3.0的设置页面中,关闭一些Brushes的时候,保存之后会显示Warning: unserialize() expects parameter 1 to be string, array given in /home/www/wp-blog/wp-content/plugins/easy-google-syntax-highlighter/easy-google-syntax-highlighter.php on line 173
设置页面的下拉框显示也不正常

查看easy-google-syntax-highlighter.php的173行:

$brushes = unserialize(get_option($key));

保存返回之后,get_option($key)返回的不是字符串而是数组,所以unserialize()函数自然会报错,简单的办法就是加个判断

if(is_array(get_option($key)))
$brushes = get_option($key);
else
$brushes = unserialize(get_option($key));

这样就可以解决这个错误了。

评论

此博客中的热门博文

SSH代理使用说明

BuyVM黑掉了

PhotonVPS的Xen VPS性能