Page MenuHomePhabricator

TypeError: undefined is not an object (evaluating 'mw.config.get('wgFormattedNamespaces')[namespace].replace')
Closed, ResolvedPublic

Description

Observed on https://m.mediawiki.org/wiki/Topic:Vlnhpdx1pzh78x9n?markasread=1138864&markasreadwiki=mediawikiwiki

This appears to be an issue in mediawiki.Title.

I'm not sure if this is a problem with Flow or mediawiki core at this point.

at getNamespacePrefix https://m.mediawiki.org/wiki/Topic:Vlnhpdx1pzh78x9n?markasread=1138864&markasreadwiki=mediawikiwiki:665:921
at https://m.mediawiki.org/wiki/Topic:Vlnhpdx1pzh78x9n?markasread=1138864&markasreadwiki=mediawikiwiki:668:979
at getTalkPage https://m.mediawiki.org/wiki/Topic:Vlnhpdx1pzh78x9n?markasread=1138864&markasreadwiki=mediawikiwiki:673:515
at https://m.mediawiki.org/wiki/Topic:Vlnhpdx1pzh78x9n?markasread=1138864&markasreadwiki=mediawikiwiki:145:315
at https://m.mediawiki.org/wiki/Topic:Vlnhpdx1pzh78x9n?markasread=1138864&markasreadwiki=mediawikiwiki:117:472
at mightThrow https://m.mediawiki.org/w/load.php?lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=minerva&version=kgetu:49:154
at https://m.mediawiki.org/w/load.php?lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=minerva&version=kgetu:49:818

82 errors on mw.org in last 30 days

Event Timeline

Restricted Application added subscribers: Masumrezarock100, Aklapper. · View Herald Transcript

I can reproduce this in Firefox:

TypeError: mw.config.get(...)[namespace] is undefinedload.php:35364
        getNamespacePrefix
        makeTitle
        getTalkPage
        exports@1
        exports@2
        mightThrow
        process
wgFormattedNamespaces
{
  "0": "",
  "1": "Talk",
  "2": "User",
  "3": "User talk",
  "4": "Project",
  "5": "Project talk",
  "6": "File",
  "7": "File talk",
  "8": "MediaWiki",
  "9": "MediaWiki talk",
  "10": "Template",
  "11": "Template talk",
  "12": "Help",
  "13": "Help talk",
  "14": "Category",
  "15": "Category talk",
  "90": "Thread",
  "91": "Thread talk",
  "92": "Summary",
  "93": "Summary talk",
  "100": "Manual",
  "101": "Manual talk",
  "102": "Extension",
  "103": "Extension talk",
  "104": "API",
  "105": "API talk",
  "106": "Skin",
  "107": "Skin talk",
  "486": "Data",
  "487": "Data talk",
  "828": "Module",
  "829": "Module talk",
  "1198": "Translations",
  "1199": "Translations talk",
  "2300": "Gadget",
  "2301": "Gadget talk",
  "2302": "Gadget definition",
  "2303": "Gadget definition talk",
  "2600": "Topic",
  "5500": "Newsletter",
  "5501": "Newsletter talk",
  "-2": "Media",
  "-1": "Special"
}
exports@1:prettified
'resources/skins.minerva.scripts/talk.js': function (require, module) {
  module.exports = function (mobile) {
    var SKIN_MINERVA_TALK_SIMPLIFIED_CLASS = 'skin-minerva--talk-simplified',
      toast = mobile.toast,
      currentPage = mobile.currentPage(), // "Topic:Vlnhpdx1pzh78x9n"
      api = new mw.Api(),
      overlayManager = mobile.OverlayManager.getSingleton(),
      skin = mobile.Skin.getSingleton(),
      talkTitle = currentPage.titleObj.getTalkPage() ? currentPage.titleObj.getTalkPage().getPrefixedText()  : undefined;
      //                               ⬆
exports@2
if (permissions.talk) {
  require('./talk.js') (mobile);
}

So it looks like the issue is that there is no Topic_talk namespace registered with MediaWiki, and mw.Title assumes that all non-special namespaces can have a talk page.

Umherirrender added a subscriber: Umherirrender.

T172146: Remove unchecked calls to Title::getTalkPage from extensions is for the php side, it seems there is no task for the js side

mw.Ttitle has canHaveTalkPage, but thats only check for non-special, so T165149: RFC: Drop requirement to define a talk namespace for every subject namespace is missing for the js side

Change 617591 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/core@master] Account for non-existence namespaces in makeTitle

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

Change 617591 merged by jenkins-bot:
[mediawiki/core@master] Account for non-existence namespaces in makeTitle

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

Jdlrobson claimed this task.

Thanks for the review!