最新消息:

WordPress插件crayon-syntax-highlighter出现invalid range错误

wordpress 梧桐 1336浏览 0评论

今天在测试站点发现一个问题,网站头满屏的:

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/wwwroot/www.attx.org/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/wwwroot/www.attx.org/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/wwwroot/www.attx.org/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

有点奇怪,主站就没事,找到/www/wwwroot/www.attx.org/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php这个文件查看:

// Override
	function clean_id($id) {
        $id = CrayonUtil::space_to_hyphen( strtolower(trim($id)) );

        return preg_replace('/[^\w-+#]/msi', '', $id);
	}

找到报错的这一行,将return preg_replace('/[^\w-+#]/msi', '', $id);改为return preg_replace('/\[^\w-+#]/msi', '', $id);

转载请注明:八度生活 » WordPress插件crayon-syntax-highlighter出现invalid range错误

您必须 登录 才能发表评论!