Page MenuHomePhabricator

Multiple parameters with same alias allowed
Open, Needs TriagePublic


TemplateData forbids multiple parameters with the same name by design (as they’re JSON keys), but aliases are not filtered: I was able to add 1 as the alias of n and nq as well on c:Template:Number cat/doc (this is not simply testing, by the way, the template has been designed so that 1 is actually an alias for both parameters…), and it even gets served to clients. There should be some check to prevent such cases, as clients have no clue what parameter is that.

Event Timeline

Restricted Application added a project: VisualEditor. · View Herald TranscriptSep 16 2019, 4:37 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald Transcript
Mvolz added a subscriber: Mvolz.Sep 17 2019, 10:58 AM

Since these parameters indeed both have the same alias, isn't that as desired? In practice, only parameters, not aliases, are offered by the GUI interface for Template Data anyway - I think aliases are just for documentation reasons mostly?

It depends. I don’t know about any consumer providing aliases when inserting new parameters, but they’re used to understand already-existing templates (e.g. by VisualEditor template editor).

JTannerWMF added a subscriber: JTannerWMF.

Hi @Tacsipacsi, what does this problem actually cause, so we can better determine how to support you?

This problem causes that a parameter name may belong to more than one field. This means that a program parsing wikitext (e.g. VisualEditor template editor) cannot reliably decide which field is given in the wikitext, so it either warns the user (which is almost certainly not the case as long as this behavior is undocumented), or assigns it to one of the possible fields in an undefined or implementation-defined way.

Thank you for providing further information about this issue @Tacsipacsi, we can not prioritize fixing it at this moment but will keep an eye on it.