[pmwiki-users] PHP 5.3 woes.

Vince Administration vadmin at math.uconn.edu
Sat Oct 24 09:42:25 CDT 2009


On Oct 24, 2009, at 5:34 AM, rogutes at googlemail.com wrote:

> Vince Admin Account (2009-10-23 16:01):
>>
>> On Oct 19, 2009, at 5:13 PM, rogutes at googlemail.com wrote:
>>
>>>
>>> The problem with pagelists lies in GlobToPCRE() function in  
>>> pmwiki.php
>>> and is tracked at http://pmwiki.org/wiki/PITS/01149 . It concerns
>>> exclusion patterns (name=-Page) only.
>>>
>>
>
> (:pagelist group=-PmWiki*,-Site*:) works fine here. Doesn't it work  
> for
> you? Are you sure you've made the right changes to GlobToPCRE()? The
> line with str_replace call looks like this after changing:
>
> $pat = str_replace(array('\\*', '\\?', '\\[', '\\]', '\\^', '\\-'),
>                   array('.*',  '.',   '[',   ']',   '^', '-'), $pat);
>
Well, I think I am sure. I can cut and paste, in case my eyes are too  
tired. Here is the entire function.
function GlobToPCRE($pat) {
   $pat = preg_quote($pat, '/');
   $pat = str_replace(array('\\*', '\\?', '\\[', '\\]', '\\^', '\\-'),
                      array('.*',  '.',   '[',   ']',   '^', '-'),  
$pat);
   $excl = array(); $incl = array();
   foreach(preg_split('/,+\s?/', $pat, -1, PREG_SPLIT_NO_EMPTY) as $p) {
     if ($p{0} == '-'  ) $excl[] = '^'.substr($p, 0).'$';
     else $incl[] = "^$p$";
   }
   return array(implode('|', $incl), implode('|', $excl));
}

Some other interesting things I found here.  We are running Apple Snow  
Leopard, PHP 5.3.0 and Apache 2.2.11.
When I tried to test pieces of this code on my web page,  the line
$pat = preg_quote($pat,'\');
gave a syntax error.  It worked as in the manual with a few other  
characters instead of \. I did get it to work as advertised with
$pat = preg_quote($pat,'\\');
I tried that in GlobToPCRE, but it didn't help.     So I am confused.   
But at least I do have the workaround.
              Vince
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20091024/41c7e299/attachment.html 


More information about the pmwiki-users mailing list