Page MenuHomePhabricator

No error given for duplicate template parameters
Closed, ResolvedPublic

Description

Author: andrussm

Description:
There are various ways that a Cite template could end up with the same parameter name coded more than once. I don't know of a legitimate reason for doing this, so as far as I know any such duplication would be unintentional and would produce undesirable results.

I have tested multiple first= and last= parameters, and the software ignores all but the last occurrence and does not throw an error. I may be wrong, but I assume that the same would be true for all Cite parameters.

I have been cleaning up refs, starting each ref by copy-and-pasting an empty Cite template from Notepad. This contained "|first= |last=", which I filled in with the author's name. If there were multiple authors, I first copy-and-pasted the "|first= |last=" string to duplicate it as many times as needed. Then, due to ADD, I sometimes neglected to change the added parameter names to first2, last2, etc.

I don't know of a legitimate reason for duplicate parameter names, so as far as I know any such duplication would be unintentional and would yield undesirable results. So it would seem that principles of good software design would suggest throwing an error. Yes, I was negligent in forgetting to change the parameter names, but people will make mistakes and the software could tell them that they did rather than allowing the error to remain.


Version: 1.25-git
Severity: enhancement

Details

Reference
bz69964

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:39 AM
bzimport added a project: MediaWiki-Templates.
bzimport set Reference to bz69964.
bzimport created this task.Aug 24 2014, 5:47 PM

Change 136123 had a related patch set uploaded by Jackmcbarn:
Add a tracking category for duplicate arguments

https://gerrit.wikimedia.org/r/136123

andrussm wrote:

I guess this system isn't intended for us by mere mortals like me, since I don't understand the response. I do understand what a tracking category is, and my test case is only in one hidden category: Wikipedia pages with incorrect protection templates. I don't think that's it. So I'll assume that everything that can be done has been done or will be done. Thank you.

The category isn't there because my change isn't active yet. Someone needs to review and accept it. One to two weeks after that happens, it will become active on Wikipedia.

andrussm wrote:

Very good, I'll watch for that. Thank you again.

This ticket gets closed as "resolved fixed" once the corresponding code change is *merged* in the Gerrit/Git code review system (see link in comment 1).

Change 136123 merged by jenkins-bot:
Add a tracking category for duplicate arguments

https://gerrit.wikimedia.org/r/136123

This change will become active on all WMF wikis on October 23rd.

leo_wallentin wrote:

There are a few templates on svwp that uses the |= hack to draw ”check boxes” and ”input boxes” in templates. Those page are now filling up this category, because of duplicate empty string parameters. See an usage example here: https://sv.wikipedia.org/wiki/Mall:Kina-h%C3%A4rad#Exempel

IMO, the fix for that is to stop doing that, but if you really think it's an issue, open a separate bug about it.