Last modified: 2009-05-15 00:16:45 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 T6708, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 4708 - Default parameter values are not used when a parameter is explicitly set to null
Default parameter values are not used when a parameter is explicitly set to null
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
1.6.x
All All
: Normal normal with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 364
  Show dependency treegraph
 
Reported: 2006-01-21 23:13 UTC by David Benbennick
Modified: 2009-05-15 00:16 UTC (History)
4 users (show)

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


Attachments

Description David Benbennick 2006-01-21 23:13:37 UTC
For example, the top of [[User:Dbenbenn/sandbox]] contains

{{User:Dbenbenn/sandbox2|size=}}

[[User:Dbenbenn/sandbox2]] is simply "{{{size|foo}}}".  In the past, "foo" would
show.  Now nothing does.

A real-life case where this causes a problem is in [[Template:Country
flagcountry]].  It currently uses

{{qif|test={{{size|}}}|then={{{size}}}|else=22x20px}}

and it has to, because it is called via [[Template:Country]], which passes the
"size" parameter forward via "size={{{size|}}}"
Comment 1 lɛʁi לערי ריינהארט 2006-01-22 01:49:53 UTC
Adding "blocks"
Bug 364: Optional parameters (and/or default parameter values) in templates

Please verify this dependency at the dependency tree for Bug 2376
http://bugzilla.wikimedia.org/showdependencytree.cgi?id=2376
and change it if necessary.
Comment 2 lɛʁi לערי ריינהארט 2006-01-22 02:04:24 UTC
Oops! Collision! Sorry!
Comment 3 omniplex 2006-06-30 16:06:17 UTC
Empty is not the same as undefined, and defined is not the same as not empty,
I fail to see any "bug" here. Templates (q)if(n)def are pretenders, and poor
#if: is damned to emulate their oddities, but for a real test you can always
#ifeq:{{{x|+}}}|{{{x|-}}}|defined|undefined
Comment 4 Waldir 2009-05-14 17:37:02 UTC
I know undefined and empty are different concepts, but mediawiki is not a programming platform, it deals mainly with text content instead. It seems to me that assuming they're equal (as #if: currently does) would bring more good than evil.

On one hand, I can see several uses for leaving a parameter without a value (in an infobox, for example, for later filling -- that would greatly simplify the code in the template size, by removing all those ugly #if: tests).

On the other hand, I can't think of any reason one would want to explicitly set a parameter to an empty string; still, in that case, passing a whitespace (perhaps hardcoded as   or  ?) should suffice.
Comment 5 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-05-14 20:53:25 UTC
(In reply to comment #4)
> On one hand, I can see several uses for leaving a parameter without a value (in
> an infobox, for example, for later filling -- that would greatly simplify the
> code in the template size, by removing all those ugly #if: tests).

Which #if tests could be removed?  You'd still need to check if it's defined to know if you should render the row, typically.

> On the other hand, I can't think of any reason one would want to explicitly set
> a parameter to an empty string

You would if, for some reason, an empty value makes sense but is not the default.  This is likely to occur in at least some cases.

> still, in that case, passing a whitespace
> (perhaps hardcoded as   or  ?) should suffice.

  and   are definitely not whitespace.  They're entities, and are therefore explicitly *not* treated as whitespace.  Unless you meant the corresponding Unicode characters, which would cause complete confusion.  I don't see any way that this proposal would allow passing whitespace in the event you really did want it, which would be an unacceptable loss of flexibility.

On top of that, the change would most likely break thousands of templates across many wikis -- any significant behavior like this is likely to be relied upon by some people.  So I'd be strongly inclined to WONTFIX.
Comment 6 Brion Vibber 2009-05-15 00:16:45 UTC
Original request for behavior change was three years ago; current templates would be broken by the suggestion even if it was desirable which it's not clear that it is. Resolving as INVALID.

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


Navigation
Links