Page MenuHomePhabricator

TinyMce REL1_32, MediaWiki, undefined method TitleValue::getArticleID() when opening page Special:Categories
Closed, ResolvedPublic

Description

I don't know if here is the right place for the mentioned package REL1_32 from GitHub.

  • Activated debug after I got an error. ($wgShowExceptionDetails = true;)
  • When opening the page Special:Categories I get the following message/backtrace:
[XDq3DFUNgIIAAHdrZA8AAAAW] /index.php?title=Spezial:Kategorien Error from line 415 of /extensions/TinyMCE/TinyMCE.hooks.php: Call to undefined method TitleValue::getArticleID()

Backtrace:

#0 /extensions/TinyMCE/TinyMCE.hooks.php(358): TinyMCEHooks::enableTinyMCE(TitleValue, RequestContext)
#1 /includes/Hooks.php(174): TinyMCEHooks::changeRedLink(MediaWiki\Linker\LinkRenderer, TitleValue, boolean, string, array, NULL)
#2 /includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#3 /includes/linker/LinkRenderer.php(363): Hooks::run(string, array)
#4 /includes/linker/LinkRenderer.php(348): MediaWiki\Linker\LinkRenderer->buildAElement(TitleValue, string, array, boolean)
#5 /includes/linker/LinkRenderer.php(151): MediaWiki\Linker\LinkRenderer->makeBrokenLink(TitleValue, string, array, array)
#6 /includes/specials/pagers/CategoryPager.php(88): MediaWiki\Linker\LinkRenderer->makeLink(TitleValue, string)
#7 /includes/pager/IndexPager.php(446): CategoryPager->formatRow(stdClass)
#8 /includes/specials/pagers/CategoryPager.php(82): IndexPager->getBody()
#9 /includes/specials/SpecialCategories.php(56): CategoryPager->getBody()
#10 /includes/specialpage/SpecialPage.php(569): SpecialCategories->execute(NULL)
#11 /includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)
#12 /includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#13 /includes/MediaWiki.php(860): MediaWiki->performRequest()
#14 /includes/MediaWiki.php(517): MediaWiki->main()
#15 /index.php(42): MediaWiki->run()
#16 {main}

(Maybe line 415 is not correct because I added debug lines to TinyMCE.hooks.php).

The reason seems to be that $title in line

'pp_page' => $title->getArticleID(),
}

isn't an instance of class Title but of class TitleValue in this case.

Tested also with current TinyMCE-0.2: No error.

Event Timeline

Illovo created this task.Jan 13 2019, 4:42 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 13 2019, 4:42 AM

I had the very same problem (with TinyMCE master and MW 1.31.1).
I could solve this by adding this to my LocalSettings.php:

$wgTinyMCEDisabledNamespaces[] = NS_CATEGORY;

While modifying $wgTinyMCEDisabledNamespaces lets me view the page again, this looks more like a workaround than a solution.
The problem occurs when there are any category pages without content. After adding content (may be empty) to all affected category pages, the error is gone even without the workaround.
Apparently the extension does not handle category pages without content correctly.

Hi, I just tried this with Mediawiki 1.31 and the most recent TinyMCE master and everything seems to be working OK. It might be that a recent change has solved the problem or maybe you are using a different version of mediawiki. Would you let me know which versions you are using? Thanks

Problem occurs with Mediawiki 1.31.6, TinyMCE 0.3 (REL1_31). As noted, there must be at least 1 category page without content, i.e. Links to the category are displayed in a red font.

Thanks for the quick response. Due to a misunderstanding on my part, fixes to the code haven't been backported to previous releases. I'm sorry this wasn't clear from the documentation until recently when I added the compatibility policy is 'master'.
The background to this misunderstanding is explained in the dialogue I had with James Forrester in the comments on this patch.
Would you try the current master branch to see if you still get this problem? This should work with mediawiki 1.31.6. I apologise for any inconvenience, Duncan.

I tried out the master branch and the problem no longer occurs.

aoxomoxoa closed this task as Resolved.Fri, Feb 14, 8:33 AM
aoxomoxoa claimed this task.

Hi, thank you for retesting and letting me know.