• Everything seemed to be working just fine only until few hours go.

    Now I am getting Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in /site/public_html/wp-includes/class-wp.php on line 204 on every page.

    Could somebody help me resolve this issue?

Viewing 15 replies - 1 through 15 (of 15 total)
  • That sounds like a PHP warning. PHP uses a library called PCRE (Perl Compatible Regular Expressions) and this warning usually occurs when PCRE and/or PHP is out of date.

    To keep the warnings from displaying on your site, add this to wp-config.php:

    error_reporting(0);
    @ini_set('display_errors', 0);

    As to why this happened, it’s hard to say. I’ve seen a few things break when hosts upgrade their PHP version.

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    @scriptrunner: Many thanks for quick troubleshoot.

    I added the suggest code in the wp-config.php but it hasn’t made any difference. I am still seeing that warning message.

    I am using PHP Version 5.3.27 and PCRE Library version 8.32 2012-11-30.

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    @scriptrunner: Is there a specific location in wp-config.php I should add the suggested code?

    I tried it right above /* That’s all, stop editing! Happy blogging. */ line and also right at the start of wp-config.php as well.

    Is this on a live server or local?

    You could try and deactivate plugins 1 by 1, see if one of them is to blame.

    or quickly switch the theme over to twentyx see if it still happens.

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    @lee@digitalcorn: Its on live server. But I didn’t update any plugins. And everything was working just fine about an hour ago or so.

    I am going to try to do the suggestion made by you.

    It shouldn’t matter where you place it in wp-config.php.

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    @lee@digitalcorn: I turned on the Twenty Twelve theme but still showing the same warning message on pages.

    Update:

    In order for the line above to work, it most come after the call to wp-settings.php – for example:

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');
    
    error_reporting(0);

    Another thing to try:

    Disable all your plugins and then change your permalink settings back to “Default.” (if it’s already set to Default, then change it to something else). Apparently sometimes permalink structure gets corrupted and cause this warning.

    I think the PHP/PCRE versions you listed are fine.

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    @Scriptingrunner: Adding your suggested code right at the bottom of wp-config.php worked and made the error disappear.

    I also figured out that it was “Async JS and CSS” that once deactivated got the error display gone even without the help of the code suggested by you.

    But I’ve checked that there has not been any code change in “Async JS and CSS” plugin and I have not made or changed any other plugin’s settings, I wonder why such an error started cropping up suddenly.

    Only settings that I ever made using that plugin was minify CSS, which did improve my page speed to some extent.

    But for now I have deactivated that plugin.

    Awesome, glad you got it figure out.

    @rohitbhalara4 was right. Generally best to disable plugins and switch to a default theme first. I’ve seen multiple things cause this warning, but actually never a plugin!

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    Thank you Scriptingrunner and lee@digitalacorn for taking the time to troubleshoot.

    Thread Starter rohitbhalara4

    (@rohitbhalara4)

    @Scriptingrunner: The strange thing was that it din’t happen yesterday when I activated the plugin and made that setting but almost a day after since I activated that plugin. And during all that time I din’t make any plugin settings changes or updated any plugins either. It just started cropping up a while ago.

    Thank you.

    I just had this issue, I traced it to a rewrite function with regex expressions. Therefore I changed my permalinks to default, then back to “post name” and now the site is working find without the warnings again.

    My exact warning message was:
    Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in /home/public_html/wp-includes/class-wp.php on line 204

    Anyone from WP-Core team care to comment on why this might be happening?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Warning: preg_match(): Compilation failed: nothing to repeat at offset 1..’ is closed to new replies.