permalinks issue Warning: preg_match() (4 posts)

  1. Mihai
    Posted 3 years ago #

    Hey guys.
    Whenever i try to use any other permalink form besides the default one i get losts of errors like this:

    Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (? or (?- at offset 3 in /home/littleco/public_html/wp-includes/class-wp.php on line 204
    Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (? or (?- at offset 3 in /home/littleco/public_html/wp-includes/class-wp.php on line 205
    Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/littleco/public_html/wp-includes/class-wp.php on line 204

    any idea whats causing it ?

    PHP info page here: http://www.littlebuildingco.com/info.php

  2. jnz31
    Posted 3 years ago #

    could you plz explain how you solved this?
    i do have the same problem and it only occurs, if i enable wp-ecommerce. drives me nuts. php and pcre are pretty much up to date (php: 5.4.9, pcre: 8.31 2012-07-06). saw that you mentioned pcre in the wpsc forum.

  3. Mihai
    Posted 3 years ago #

    At the moment the only option was to hide the PHP warning messages in htaccess.

    But this is not a WPEC issue its something related to each hosting account

  4. Tdude
    Posted 2 years ago #


    Having the same issue and after some googling, there's always a fix. The error seems to come from a regexp library on Apache server and versions 5.2x of PHP. It seems WPSC (and possibly other plugins) may use a more modern regular expressions library/search than is allowed.

    It sucks to have hundreds of google links point at your friendly urls, but you get dead pages... so I found this thread with a very temporary fix: http://wordpress.org/support/topic/upgraded-wordpress-to-36-next-gen-gallery-no-longer-workds

    In short, you could open your wp-includes/class-wp.php and on line 204 and 205 insert a "@" to turn off the regex error messages.
    Original code:

    if ( preg_match("#^$match#", $request_match, $matches) ||
    preg_match("#^$match#", urldecode($request_match), $matches) ) {

    New code:

    if ( @preg_match("#^$match#", $request_match, $matches) ||
    @preg_match("#^$match#", urldecode($request_match), $matches) ) {

    This fix won't brake things that work, but you probably shouldn't develop a plugin using it.

    To really solve the problem, you should upgrade PHP to the latest version, but I know, your host sucks and won't answer your requests, so don't be a victim, change host!

    All the best,

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.