Page MenuHomePhabricator

Cannot include template:R with "{{R}}"
Closed, ResolvedPublic

Description

Author: fyrenmoo

Description:
On a wiki I contribute to running 1.7.1 as well as on English Wikipedia (as of
this report), including template:R with {{R}} doesn't work as expected and
includes nothing. {{r}} works as expected by including template:R. Using
{{subst:R}} similarly substitutes nothing while {{subst:r}} substitutes in the
template.

I think this might have been caused by the change to the "raw" syntax for
variables (e.g. {{NUMBEROFPAGES:R}}, see
http://mail.wikipedia.org/pipermail/wikitech-l/2006-July/036836.html), but I'm
unsure.


Version: 1.7.x
Severity: minor

Details

Reference
bz6965

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:19 PM
bzimport set Reference to bz6965.
bzimport added a subscriber: Unknown Object (MLST).

Please include a URL to a specific page showing the problem

fyrenmoo wrote:

Template:R isn't used anywhere on English Wikipedia, so I made an example in the
sandbox:

http://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&oldid=69278571

fyrenmoo wrote:

This happens because the new way of getting the raw values of some magic words
added "R" as a magic word itself (with ID "rawsuffix"). So when the parser is
doing variable substitution, it sees {{R}} as a magic word rather than a
template and then replaces it with the result of getVariableValue('rawsuffix'),
which is always null.

jimmy.collins wrote:

When R is an magic word and cannot be used as template name, this bug should be
closed as invalid.

ayg wrote:

Surely something not likely to be duplicated by end-users could be used instead.

ayg wrote:

*** Bug 7822 has been marked as a duplicate of this bug. ***

robchur wrote:

Tentative patch

Patch introduces the concept of magic words which are "modifiers", and alters the parser to ignore such when dealing with magic words in Parser::replaceVariables(), then adds "rawsuffix" to the default list.

Seems to work in testing and doesn't seem to cause problems, but I'd like this one reviewed.

Attached:

Hmmm, sounds reasonable I guess? Unless they're supposed to be more broken up by location.

webboy wrote:

Why is 'rawsuffix' in MagicWord::$mVariableIDs?

Index: includes/MagicWord.php

  • includes/MagicWord.php (revision 23739)

+++ includes/MagicWord.php (working copy)
@@ -86,7 +86,6 @@

'subjectpagename',
'subjectpagenamee',
'numberofusers',
  • 'rawsuffix', 'newsectionlink', 'numberofpages', 'currentversion',

fixes this bug.