Page MenuHomePhabricator

ParserFunctions: ifeq compares numbers other than strings
Closed, InvalidPublic


Author: upssdr

Using {{#ifeq: 03|3|eq|ne}}, it gives eq but not ne. This shows what ifeq compares are
not strings but numbers.

According to m:ParserFunctions#ifeq, ifeq should compares strings other than numbers.
But in you see how it is.

In ParserFunctions.php (
ParserFunctions/ParserFunctions.php?view=markup&pathrev=13773), the ifeq function is:
if ( $left == $right ) {

return $then;

} else {

return $else;

The "==" may be the cause of problem.

Version: unspecified
Severity: normal
OS: Windows 2000
Platform: PC



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:12 PM
bzimport set Reference to bz5693.
bzimport added a subscriber: Unknown Object (MLST).

omniplex wrote:

As far as I'm concerned that's a feature and no bug, because
forcing string comparison is simple, just add something that
can't be numerical, e.g. use "p1" + "p2" instead of p1 + p2
for the first two parameters, or add character @ in front.

Related question: Should we have default "then" and "else"
result texts, more precisely 1 for equal and 0 for not equal?

upssdr wrote:

Default then and else is empty. So the syntax can be like this:

{{#ifeq: [str1 [| str2 [| then [| else]]]] }}

omniplex wrote:

Okay, please decree this bug as "WONTFIX", because it was never broken... :-)