Warning: Compilation failed error

Are you suffering from:

Warning: Compilation failed: characters with values > 255 are not yet supported in classes at offset 16 in /path/to/website/blog/wp-includes/shortcodes.php on line xxx.

Fix it by changing a lineĀ  in /wp-includes/shortcodes.php. Look for the section headed “function shortcode_parse_atts($text)” and change the preg_replace line with

$text = preg_replace("/[\x{00a0}\x{ff}]+/u", " ", $text);

This maintains the functionality but only includes the supported characters.

This error occurs when using a version of PHP with an outdated PCRE library.

3 thoughts on “Warning: Compilation failed error”

  1. When using the RSS feed widgit we also found it necessary to edit class-simplepie.php in the same way:

    we replaced
    return (bool) preg_match(‘/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{
    FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{6
    0000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{
    BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u’, $
    string);

    with

    return (bool) preg_match('/[\x{00a0}\x{ff}]+/u', $string);

  2. Thanks a lot for posting about this Rex, very helpful indeed. My server was using quite an old version of PHP so this had to be changed.

    Also thanks to admin for the second part of that code, it’s a symptom of the old PHP version that affects both, so I think anyone needing to do one of these fixes will need to do both.

Comments are closed.