Table of Contents
WordPress Markdown插件Crayon Syntax Highlighter在PHP 7.3/7.4版本中出错。
Markdown的文档会显示空白,查看Apache错误日志有下面错误:
1 2 3 |
PHP Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /data1/svr/wordpress/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340 |
解决方法如下,编辑
1 2 3 |
vi ./wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php +340 |
修改
1 2 3 |
return preg_replace('/[^\w-+#]/msi', '', $id); |
为
1 2 3 |
return preg_replace('/[^w\-+#]/msi', '', $id); |