Last modified: 2006-05-24 09:05:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 5693 - ParserFunctions: ifeq compares numbers other than strings
ParserFunctions: ifeq compares numbers other than strings
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
PC Windows 2000
: Normal normal with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://meta.wikimedia.org/wiki/User:U...
: parser
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-23 09:03 UTC by Upssdr
Modified: 2006-05-24 09:05 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Upssdr 2006-04-23 09:03:30 UTC
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 http://meta.wikimedia.org/wiki/User:Upssdr/tmp you see how it is. 

In ParserFunctions.php (http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/
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.
Comment 1 omniplex 2006-05-11 04:26:07 UTC
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?

Comment 2 Upssdr 2006-05-13 05:07:51 UTC
Default then and else is empty. So the syntax can be like this: 

{{#ifeq: [str1 [| str2 [| then [| else]]]] }} 
Comment 3 omniplex 2006-05-24 01:59:51 UTC
Okay, please decree this bug as "WONTFIX", because it was never broken... :-)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links