Good Day,

I am getting this php error message (see below). How can I fix this or any ideas on how to fix it?

preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /hsphere/local/home/useraccount/website.com/modules/pathauto/pathauto.module on line 323.

Thank you very much,

Mark

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

what version of php are you using? I assume it's one of the ones that isn't supported.

The project page and the 5.x-2 release notes both say that you need to use PHP4.4 or PHP5.1 or higher to get Pathauto5.x-2.x to work. Your solution is either to just use Pathauto 5.x-1.x (which is very similar...) or upgrade your PHP.

mrgoltra’s picture

thanks for the info, yeah my hosting provider is still using an older version of php... I been asking them to upgrade and they say its in the works... thanks.

greggles’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Ok - good to know.

gateone’s picture

Hm, my PHP version is 5.1.2 and I do get the same error...

nckabill’s picture

I am getting the same errors/warnings although it does appear to work still. My php is version 5.1.6

nckabill’s picture

I get a slightly different warning actually:

warning: preg_match() [function.preg-match]: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /var/www/kfp/modules/pathauto/pathauto.inc on line 72.
gateone’s picture

The error has to do with the preg_match() function in line 72:

  // In preparation for pattern matching, 
  // escape the separator if and only if it is not alphanumeric)
  if (isset($separator)) {
    if (preg_match('/^(\pL|\pN)+$/D', $separator)) {
      $seppattern = $separator;
    } 
    else {
      $seppattern = '\\'. $separator;
    }

The problem here is related to PCRE library (Perl Compatible Regular Expressions - http://www.pcre.org). Depending on version and compilation, this library may fully support UTF-8 characters.

And this is what is happening right here. It is the grep pattern (\pL|\pN) that is causing the problem. (\pL|\pN) means "match either all (positive) Letters or match all positive Numbers. Yet we are in Unicode Regular Expressions due to the \pL or \pN notation...

Now I am not really the greatest regular expressions specialist - so PLEASE do correct me, which you probably must ;-) - but what if we change this preg_match to this:

  // In preparation for pattern matching, 
  // escape the separator if and only if it is not alphanumeric)
  // for whom might have problems with PCRE unicode compatibility...
  if (isset($separator)) {
    if (preg_match('/^[A-Za-z0-9_]+$/D', $separator)) {
      $seppattern = $separator;
    } 
    else {
      $seppattern = '\\'. $separator;
    }

Somehow this seems to be working for me - however I am not sure if things now go RIGHT or if maybe things start going wrong...

Steve

greggles’s picture

Good catch. This has actually been fixed in the latest 5.x-2.x-dev versions, so please use those. The regex you provided works fine for ~75% of the users in the world, but I went with one that should work for 100% of them. It's tricky stuff indeed - I got help from chx on this.