Page MenuHomePhabricator

"initial colon for Main namespace" check badly positioned, creating odd transclusion behaviour
Closed, ResolvedPublic


Author: rowan.collins

Certain parts of the code, notably "transclusion", use a leading colon to
indicate the main namespace, since they would otherwise refer to something else.
e.g. {{Foo}} transcludes the content of "Template:Foo"; {{:Foo}} transcludes the
content of "Foo"

The check for this initial colon is inside Title::secureAndSplit(), and before
the namespace recognition function; only a dodgy detection of ":Image:" (which
doesn't take account of canonical names for namespaces, and is anyway
unnecessary since the Title object doesn't need to know about this, Parser.php
deals with it, along with similar cases such as ":Category:") is performed
before it. Thus, a title which also has a real namespace will produce an illegal
Title object (namespace 0, but named e.g. "Project:About")

On [[meta:]] {{Project:About}} and {{Meta:About}} both work correctly.
{{:Meta:About}} renders as either a red (edit) link, a blue (normal local) link,
or a correct transclusion, depending what other related transclusions appear on
the page; {{:Project:About}} seems similar, but I haven't managed to get it to
transclude correctly, only display as a red or blue link. There seems to be some
odd effect of ¿caching?, since "{{:Meta:About}} {{Meta:About}}" produces two
redlinks, whereas "{{Meta:About}} {{:Meta:About}}" produces two transclusions.

The check in Title.php can be moved to *after* other namespace recognition (by
first removing the : but setting a variable if we do so), but there may be other
bugs in transclusion that this bug reveals. Also, is there anywhere other than
Parser::replaceInternalLinks() which needs to 'know about' ":Image:",
":Category:" et al?

Version: 1.6.x
Severity: normal



Revisions and Commits

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 6:59 PM
bzimport set Reference to bz676.

rowan.collins wrote:

I've committed a fix to this in both HEAD and 1.5, such that Titles with a
leading colon still get examined to see if there's a namespace in there - Titles
with {ns, title} like {0, Project:Foo} should never exist.

Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:22 AM