[pmwiki-users] Fix blogit for use with PHP 5.5

Tiger!P pmwiki-tigerp at tigerp.net
Mon Nov 3 14:15:54 CST 2014


On Tue, Nov 04, 2014 at 08:43:30AM +1300, John Rankin wrote:
> 
> > On Thu, Oct 30, 2014 at 05:41:42PM -0400, DaveG wrote:
> >>
> >>
> >> On 10/30/2014 1:58 PM, Tiger!P wrote:
> >> Quick questions:
> >> 1. Tiger!P: With your patch file, why are you making the change to
> >> $PageTextVarPatterns, from #blogit_(\w[_-\w]*)  to #blogit_(\w[_\w-]*)?
> >
> > To get rid of the warning "PHP Warning:  preg_match_all(): Compilation
> > failed: invalid range in character class at offset 20 in
> > /home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 797"
> >
> I think it should read (\w[-_\w]*)

It might not be completly clear, but I change the original code
"(\w[_-\w]*)"  to "(\w[_\w-]*)". So I put the - at the end.

> Otherwise, PHP interprets _-\w as "from _ to \w" which is an invalid
> range. To exclude - it has to be first in the [ ... ] set.

I understand, but I don't think it must be the first but can also be the
last, or be escaped by \ which will result in "(\w[_\-\w]*)".

At least the warning was gone when I changed the line.

Thank you for your information on this matter.

Tiger!P
-- 
A random quote:
Don't harm yourself if you don't want to.



More information about the pmwiki-users mailing list