Page MenuHomePhabricator

\ParserCache::get remove polymorphic argument
Closed, ResolvedPublic

Description

ParserCache::get remove polymorphic argument

Use WikiPage instead Page|Article|WikiPage

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/577393/26/includes/parser/ParserCache.php#247

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 27 2020, 11:43 PM

@Art-Baltai: Assuming this task is about the MediaWiki-Parser project, hence adding that project tag so other people who don't know or don't care about random team tags can also find this task when searching via projects.

Change 585055 had a related patch set uploaded (by Art-Baltai; owner: Art-Baltai):
[mediawiki/extensions/FlaggedRevs@master] ParserCache::get remove polymorphic argument

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

Change 584103 had a related patch set uploaded (by Art-Baltai; owner: Art-Baltai):
[mediawiki/core@master] ParserCache::get use WikiPage only as argument

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

Calling ParserCache::get with Article was deprecated. Need to wait for 1.36 to remove it.

Change 584103 merged by jenkins-bot:
[mediawiki/core@master] ParserCache::get use WikiPage only as argument

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

Change 585055 merged by jenkins-bot:
[mediawiki/extensions/FlaggedRevs@master] ParserCache::get and extends - use WikiPage instead Article|Page

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

abi_ added subscribers: Kghbln, abi_.Apr 23 2020, 7:03 AM

During our regular Twn updates, noticed the following incompatibility with SemanticMediaWiki,

[2020-04-22 14:58:13] exception.ERROR: [8a209061a64b161a1b7952fe] /wiki/Support   TypeError from line 133 of /srv/mediawiki/workdir/includes/parser/ParserCache.php: Argument 1 passed to ParserCache::getETag() must be an instance of WikiPage, instance of Article given, called in /srv/mediawiki/workdir/extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php on line 646 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to ParserCache::getETag() must be an instance of WikiPage, instance of Article given, called in /srv/mediawiki/workdir/extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php on line 646 at /srv/mediawiki/workdir/includes/parser/ParserCache.php:133)
[stacktrace]
#0 /srv/mediawiki/workdir/extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php(646): ParserCache->getETag(Object(Article), Object(ParserOptions))
#1 /srv/mediawiki/workdir/includes/HookRunner/HookContainer.php(283): SMW\\MediaWiki\\Hooks->onArticleViewHeader(Object(Article), false, true)
#2 /srv/mediawiki/workdir/includes/HookRunner/HookContainer.php(126): MediaWiki\\HookRunner\\HookContainer->callLegacyHook('ArticleViewHead...', Array, Array, Array)
#3 /srv/mediawiki/workdir/includes/Hooks.php(135): MediaWiki\\HookRunner\\HookContainer->run('ArticleViewHead...', Array, Array)
#4 /srv/mediawiki/workdir/includes/page/Article.php(699): Hooks::run('ArticleViewHead...', Array)
#5 /srv/mediawiki/workdir/extensions/LiquidThreads/pages/TalkpageView.php(61): Article->view()
#6 /srv/mediawiki/workdir/extensions/LiquidThreads/pages/TalkpageView.php(281): TalkpageView->showHeader()
#7 /srv/mediawiki/workdir/extensions/LiquidThreads/classes/Dispatch.php(66): TalkpageView->show()
#8 /srv/mediawiki/workdir/extensions/LiquidThreads/classes/Dispatch.php(222): LqtDispatch::talkpageMain(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#9 /srv/mediawiki/workdir/includes/HookRunner/HookContainer.php(283): LqtDispatch::tryPage(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest), Object(MediaWiki))
#10 /srv/mediawiki/workdir/includes/HookRunner/HookContainer.php(126): MediaWiki\\HookRunner\\HookContainer->callLegacyHook('MediaWikiPerfor...', Array, Array, Array)
#11 /srv/mediawiki/workdir/includes/Hooks.php(135): MediaWiki\\HookRunner\\HookContainer->run('MediaWikiPerfor...', Array, Array)
#12 /srv/mediawiki/workdir/includes/MediaWiki.php(491): Hooks::run('MediaWikiPerfor...', Array)
#13 /srv/mediawiki/workdir/includes/MediaWiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#14 /srv/mediawiki/workdir/includes/MediaWiki.php(973): MediaWiki->performRequest()
#15 /srv/mediawiki/workdir/includes/MediaWiki.php(535): MediaWiki->main()
#16 /srv/mediawiki/workdir/index.php(47): MediaWiki->run()
`

See - https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/e0b192bbdf8c7dc4087694ad0bbb654c92c93e0b/src/MediaWiki/Hooks.php#L644

Ping: @Kghbln

This is a bug in SemanticMediawiki - ParserCache::getEtag was always documented to accept WikiPage only, and not Article. The fact it worked with Article passed was a coincidence.

@abi_ Thanks for pinging! Tracked on GitHub / 4741

I want to check the status of this task

@Kghbln Do we have any problem with SemanticMediaWiki TypeError with Hook now?
Can we unblock current task?

Kghbln added a comment.May 6 2020, 3:20 PM

We actually had two pull requests to mitigate the situation:

I'd say we are cool. Thanks also to @abi_ for involving him here!

abi_ added a comment.May 6 2020, 3:32 PM

Yup, we've deployed the latest patches on translatewiki.net, and haven't seen any issues, so I'd say we are good here.

@Art-Baltai Can this task be closed since it's done?

Art-Baltai closed this task as Resolved.May 21 2020, 1:17 PM