Question
I found a crash using TWiki. At first, TWiki crashed only for some users .... Yes, I was detecting if user are logged or not just testing %USERNAME% against %WIKINAME (I am using APACHE + LDAP), using IF, but in fact, the crash has nothing to do with this, just
amazing .
Well, twiki.org crash also, so it iseasy to make understand : see
VarIFcrashTWiki
What is the problem :
%IF{"%USERNAME% = %WIKINAME%" then="YES" else="NO"}%
if %
WIKINAME% (or any other VAR or string starts with And), TWiki will crash, case of all Andreas wiki users here
It is possible to avoid this problem simply adding '' around vars :
%IF{"'%USERNAME%' = '%WIKINAME%'" then="YES" else="NO"}%
So, something like :
* Set A = someText
* Set B = AndSomeText
%IF{"'%A%' = '%B%'" then="YES" else="NO"}%
will crash TWiki too if your remove the '' chars.
Environment
TWiki.org is ok ...
-- PatrickNomblot - 07 Jul 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Thanks for reporting. Bugs:Item2607
filed.
-- PeterThoeny - 07 Jul 2006
The easy workaround would be to write
%IF{"$ USERNAME = $ WIKINAME" then="YES" else="NO"}%
(as seen in the examples IfStatements). Just in case you don't want to wait for the fix
-- HaraldJoerg - 07 Jul 2006
Adding '' is also a nice solution as I describe it. The idea is in fact simply to enhance TWiki stability against topic contents.
-- PatrickNomblot - 04 Aug 2006