Page MenuHomePhabricator

VisualEditor deletes template parameters that are named "undefined"
Closed, ResolvedPublicBUG REPORT

Description

Steps to reproduce:

  • Create a template with more than 1 parameter. Name one of the parameters literally undefined.
  • Add basic TemplateData info to the template. Can be the auto-generated stuff.
  • Start VisualEditor. Add the template.
  • Add the undefined parameter.
  • Try to add another parameter. The undefined parameter disappears.

The reason for this behavior is that the placeholder is accidentally named <template name>/undefined, and there is no way to distinguish this from a parameter that's literally named like this. The bug probably exists since 2014, see https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/116902.

Patch-For-Review:

The patch changes the ID to <template name>/, which is unique. There is only 1 placeholder at a time. I manually confirmed that this 1-line patch indeed fixes the issue.

Event Timeline

Change 699775 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Fix bad parameter ID "…/undefined" on placeholders

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

Change 699775 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Fix bad parameter ID "…/undefined" on placeholders

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