[pmwiki-users] Pagelist definition problem (fixed?)

Patrick R. Michaud pmichaud at pobox.com
Fri Oct 6 19:25:40 CDT 2006


On Fri, Oct 06, 2006 at 04:10:56PM -0400, Crisses wrote:
> >A short-term workaround might be to eliminate and/or/xor from
> >complex conditional expressions.  Try the following in local/ 
> >config.php:
> >
> >    $CondExprOps = '&&|\\|\\||[!()]';
> >
> >Then (:if expr ... :) will separate things only on
> >&&, ||, !, and parens.
> 
> WOW -- that broke things real nice ;)

I'm surprised -- it shouldn't have broken anything.  The normal
setting for $CondExprOps is 

    SDV($CondExprOps, 'and|x?or|&&|\\|\\||[!()]');

so all the above should've done is remove the words and, xor, or
from the set of matching conditions.

> I'd have to scrub through FASTData etc. and  
> see what's wrong, or maybe it's my custom code somewhere... -- but  
> the problem isn't that it's parsing "and" -- it's that it's  
> evaluating the variables BEFORE changing "and" to && in the code.   
> Why not take if statements and search/replace the shorthand with &&  
> before parsing the page variables?

PmWiki doesn't "change 'and' to &&" anywhere -- PHP understands
the 'and' operator natively.  So, if you have:

    (:if expr equal 1 2 and equal 3 3 :)

then the statement that gets evaluated by PHP is *literally*
'0 and 1', not '0 && 1'.

Pm




More information about the pmwiki-users mailing list