Page MenuHomePhabricator

{{int:}} returns raw <> interpreted as HTML tag when called on a missing message key
Closed, ResolvedPublic

Description

When an undefined message is requested via wfMessage, the result is something like “<messagekey>”, i.e. the message key in angle brackets.

When such a missing message is requested using the {{int:X}} parser function, the resulting “<X>” is treated as wikitext, or HTML. If the message key does not correspond to any allowed HTML/wikitext tag, it is escaped and works correctly. However, code such as “{{int:var}}” results in “<var>” which is passed literally to output HTML and interpreted as an HTML tag.

The problem is visible at TranslateWiki.net where the {{msg-mw}} template uses {{int:}} to show the current translation of MediaWiki messages. But when used on a message from an extension not installed on TW, the result is often broken, see e.g. the last line at http://translatewiki.net/wiki/Template:Identical/Revert, where “{{int:Code-status-reverted}}” is interpreted as “<Code-status-reverted>”, which is in turn interpreted as “<code>”.

I believe the problem was introduced in r81528, where the refactoring of intFunction() to use the wfMessage() introduced “->plain()” there.


Version: 1.21.x
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:01 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz42914.
bzimport added a subscriber: Unknown Object (MLST).

Change 226897 had a related patch set uploaded (by Umherirrender):
Escape return of {{int:}} if message not exists

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

Change 226897 merged by jenkins-bot:
Escape return of {{int:}} if message not exists

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

Umherirrender set Security to None.
Umherirrender removed a subscriber: wikibugs-l-list.