[pmwiki-devel] Testing empty string (was:php logic question)

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Wed Mar 14 04:00:29 CDT 2007


On Wed, 14 Mar 2007, Jiri Hlad?vka / OBUTEX wrote:

>
> I tested an ampty string in PmWiki and found that
>
> (:if "" :)
> and
> (:if !"" :)
>
> are both TRUE
>
> (:if equal !"" true:)
> and
> (:if equal !"" false:)
>
> are both FALSE
>
> see http://www.revida.sk/wiki/index.php/Test/8

That certainly sounds like a bug in PmWiki. However, I doubt you can draw 
any conclusions as to how PhP should behave from this. (I'm saying this 
because I think Hans was wiring PhP code.)

But back to the bug... Personally I'd expect a syntax error from

 	(:if "" :)

but as it's not NULL, I guess the result should be true. Unfortunately, I 
think many authors would expect it to return false. What do you think?
(We should look at the user case, i.e. someone doing something like

 	(:if "{$Variable}" :)

where {$Variable} is emtpy (or perhaps rather, not set)

Regards,
/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr


More information about the pmwiki-devel mailing list