Last modified: 2014-07-11 18:08:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T25192, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23192 - #default without value causes switch to default to last argument
#default without value causes switch to default to last argument
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Low minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-14 14:08 UTC by Felix Pahl
Modified: 2014-07-11 18:08 UTC (History)
2 users (show)

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


Attachments

Description Felix Pahl 2010-04-14 14:08:35 UTC
Example: {{#switch:a|b=c|#default|e=f|g=h}}

This currently expands to h. It would make sense for it to either ignore the #default key without a value (i.e. treat the value as empty) or to treat it like any other key without a value, i.e. fall through and return f. But I don't see any rationale for returning the last value.
Comment 1 Felix Pahl 2010-04-14 14:37:40 UTC
A further detail:

Usually, if more than one #default is provided, the last one is used (in contrast to other keys, where the first instance is used): {{#switch:a|b=c|#default=x|#default=y|e=f|g=h}} yields y.

However, a #default without a value causes the last value to be used (see above) even if it is followed by a proper #default with value: {{#switch:a|b=c|#default|#default=y|e=f|g=h}} yields h, not y.
Comment 2 Gerrit Notification Bot 2013-12-13 22:09:36 UTC
Change 87643 had a related patch set uploaded by Nemo bis:
Fix #switch #default to match next (not last) named parameter.

https://gerrit.wikimedia.org/r/87643
Comment 3 Gerrit Notification Bot 2014-07-11 18:06:44 UTC
Change 87643 merged by jenkins-bot:
Fix #switch #default to match next (not last) named parameter.

https://gerrit.wikimedia.org/r/87643
Comment 4 Brad Jorsch 2014-07-11 18:08:12 UTC
This should be deployed to WMF wikis with 1.24wmf14, see https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.

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


Navigation
Links