Last modified: 2005-08-20 15:46:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T2676, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 676 - "initial colon for Main namespace" check badly positioned, creating odd transclusion behaviour
"initial colon for Main namespace" check badly positioned, creating odd trans...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.6.x
All All
: Normal normal (vote)
: ---
Assigned To: Rowan Collins [IMSoP]
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-10 19:13 UTC by Rowan Collins [IMSoP]
Modified: 2005-08-20 15:46 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Rowan Collins [IMSoP] 2004-10-10 19:13:33 UTC
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?
Comment 1 Rowan Collins [IMSoP] 2005-08-20 15:46:16 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links