preg_match unknown modifier

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
nottledim
New Member
New Member
Posts: 5
Joined: Fri Sep 17, 2010 2:06 pm

preg_match unknown modifier

Post by nottledim »

I'm using v 1.82 and trying to get pretty URLs to work.  I persistently get
Warning: preg_match() [function.preg-match]: Unknown modifier '\' in /var/www-apps/newru/lib/page.functions.php on line 1336

The patterns come from an array of patterns called routes from $gCMS and they look like this:

/(?P[a-z-\/_0-9]+)\/album-(?P[0-9]+)\/(?P[0-9]+)\/(?P[0-9]+)$/
/(?P[a-z-\/_0-9]+)\/album-(?P[0-9]+)\/(?P[0-9]+)$/
/(?P[a-z-\/_0-9]+)\/album-(?P[0-9]+)\/page(?P[0-9]+)\/(?P[0-9]+)$/
/[bB]logs\/(?P[0-9]+)\/(?P[0-9]+)$/
/[bB]logs\/(?P[0-9]+)\/(?P[0-9]+)$/
/[bB]logs\/(?P[0-9]+)\/(?P[0-9]+)\/(?P[0-9]+)$/
[fF]eu\/verify\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)$/

The last one here causes the error because, as you can see, it doesn't have a starting /.

I'm stuck now, I don't really know what I'm looking at - where do I look for the root cause of this error?

Thanks
nottledim
New Member
New Member
Posts: 5
Joined: Fri Sep 17, 2010 2:06 pm

Re: preg_match unknown modifier

Post by nottledim »

I think I've found the problem - a bug I think:

line 253 in  FrontEndUsers.module.php

    $this->RegisterRoute('[fF]eu\/verify\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)$/',
                        array('action'=>'verifycode'));

should be

    $this->RegisterRoute('/[fF]eu\/verify\/(?P[0-9]+)\/(?P[0-9]+)\/(?P.*?)$/',
                        array('action'=>'verifycode'));
Post Reply

Return to “CMSMS Core”