Page MenuHomePhabricator

Interwiki Titles incorrectly return NS_MAIN from getNamespace()
Open, Needs TriagePublic

Description

Expected behaviour:

When creating an interwiki title the namespace should either be accurate, or not available.

Actual behaviour:

Interwiki titles report their namespace as NS_MAIN

ebernhardson@mwdebug1002:~$ mwscript shell.php enwiki
Psy Shell v0.9.12 (PHP 7.2.26-1+0~20191218.33+debian9~1.gbpb5a340+wmf1 — cli) by Justin Hileman
>>> $title = Title::newFromText('wikt:User:Foo')
=> Title {#2648
     +mTextform: "User:Foo",
     +mUrlform: "User:Foo",
     +mDbkeyform: "User:Foo",
     +mNamespace: 0,
     +mInterwiki: "wikt",
     +mFragment: "",
     +mArticleID: 0,
     +mRestrictions: [],
     +mCascadeRestriction: null,
     +mCascadingRestrictions: null,
     +mCascadeSources: null,
     +mRestrictionsLoaded: false,
     +prefixedText: null,
     +mTitleProtection: null,
     +mDefaultNamespace: 0,
     +mRedirect: null,
   }

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 7 2020, 8:18 PM
WDoranWMF added a subscriber: WDoranWMF.

@EBernhardson would you be able to give us a sense of the urgency or severity of this for you? What impacts it might be having? We're going to move it to Icebox for now.

This is not particularly urgent, more so surprising. I'm fixing a bug elsewhere that determined if a bare title string returned from an external source needs to be namespace prefixed, it worked for local titles but not for interwiki since interwiki reports as NS_MAIN. I understand this is an assumption that is likely baked in all over the place and unlikely to be fixed.