Bug Fix Crayon Syntax Highlighter WordPress Plugin in latest PHP 7.3

Bug Fix Crayon Syntax Highlighter WordPress Plugin in latest PHP 7.3

Today, while updating the PHP version to 7.3 we faced “preg_replace(): Compilation failed: invalid range in character class” warning in Crayon Syntax Highlighter a famous WordPress plugin. After looking into the bug we got a quick fix. We want to share that quick lifesaving fix with our valuable readers.

Before moving ahead we want to share the issue that we faced. So that our readers can also verify whether are they facing the same one or not?


Bug Fix Crayon Syntax Highlighter WordPress Plugin in latest PHP 7.3
Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /var/www/website-folder/html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Bug Fix Crayon Syntax Highlighter WordPress Plugin preg_replace() Compilation failed latest PHP 7.3

As the above warning clearly shows that warning occurs on line 340 of file wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php. So to fix this we have to open this file on our website working location.

Login to your server either via FTP client or via cPanel >> File Manager. Go to the website root working directory. Goto the wp-content >> plugins >> crayon-syntax-highlighter and open crayon_langs.class.php file.

Go to the line number 340 & replace

with

After changing the above return statement, save and close the file. Now, check your website you will see the warning has gone & issue is fixed. Cheers!!

Leave a Reply