Item1822: IF broken for numerical comparisons against zero
Priority: Urgent
Current State: Closed
Released In: 1.0.7
Target Release: patch
Applies To: Engine
Component:
Branches:
You type:
%IF{
"-1 > 0"
then="<b>test FAILED</b>"
else="test PASSED"
}%
You get:
test PASSED
That's an error in BinaryOP and UnaryOP where the sub expression is
defaulting to the empty
string if their return value is perl-false, i.e. numerically zero.
So any further numerical comparison like
-1 > 0
are evaluated lexically - not numerically
because the second argument is translated to the empty string.
--
MichaelDaum - 10 Jul 2009