Page MenuHomePhabricator

LiquidThreads: Call to a member function getRestrictions() on null
Closed, ResolvedPublic

Description

Error

MediaWiki version: 1.35.0-wmf.30

message
Call to a member function getRestrictions() on null

Impact

One of these in the wild since deploy of 1.35.0-wmf.30.

Notes

Reproducible at the request URL.

Details

Request ID
XqhvMQpAICsAAImAoh4AAADW
Request URL
https://www.mediawiki.org/wiki/Thread:Project:Support_desk/extension:wikibase_(2)/reply_(2)
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2254): Thread->canUserReply(User, string)
#1 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2012): LqtView->showReplyBox(Thread)
#2 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2180): LqtView->showThreadReplies(Thread, integer, integer, boolean, array, boolean)
#3 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(1998): LqtView->showThread(Thread, integer, integer, array)
#4 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2180): LqtView->showThreadReplies(Thread, integer, integer, boolean, array, boolean)
#5 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(1998): LqtView->showThread(Thread, integer, integer, array)
#6 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2180): LqtView->showThreadReplies(Thread, integer, integer, boolean, array, boolean)
#7 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(1998): LqtView->showThread(Thread, integer, integer, array)
#8 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2180): LqtView->showThreadReplies(Thread, integer, integer, boolean, array, boolean)
#9 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(1998): LqtView->showThread(Thread, integer, integer, array)
#10 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/View.php(2180): LqtView->showThreadReplies(Thread, integer, integer, boolean, array, boolean)
#11 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/pages/ThreadPermalinkView.php(217): LqtView->showThread(Thread, integer, integer, array)
#12 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/Dispatch.php(104): ThreadPermalinkView->show()
#13 /srv/mediawiki/php-1.35.0-wmf.30/extensions/LiquidThreads/classes/Dispatch.php(225): LqtDispatch::threadPermalinkMain(OutputPage, Article, Title, User, WebRequest)
#14 /srv/mediawiki/php-1.35.0-wmf.30/includes/HookRunner/HookContainer.php(283): LqtDispatch::tryPage(OutputPage, Article, Title, User, WebRequest, MediaWiki)
#15 /srv/mediawiki/php-1.35.0-wmf.30/includes/HookRunner/HookContainer.php(126): MediaWiki\HookRunner\HookContainer->callLegacyHook(string, array, array, array)
#16 /srv/mediawiki/php-1.35.0-wmf.30/includes/Hooks.php(135): MediaWiki\HookRunner\HookContainer->run(string, array, array)
#17 /srv/mediawiki/php-1.35.0-wmf.30/includes/MediaWiki.php(491): Hooks::run(string, array)
#18 /srv/mediawiki/php-1.35.0-wmf.30/includes/MediaWiki.php(305): MediaWiki->performAction(Article, Title)
#19 /srv/mediawiki/php-1.35.0-wmf.30/includes/MediaWiki.php(973): MediaWiki->performRequest()
#20 /srv/mediawiki/php-1.35.0-wmf.30/includes/MediaWiki.php(535): MediaWiki->main()
#21 /srv/mediawiki/php-1.35.0-wmf.30/index.php(47): MediaWiki->run()
#22 /srv/mediawiki/w/index.php(3): require(string)
#23 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 28 2020, 6:15 PM
brennen triaged this task as Unbreak Now! priority.Apr 28 2020, 6:19 PM
brennen added a project: User-brennen.

Adding as blocker and setting UBN, per policy. Not at this time rolling back since there's been exactly one of these.

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptApr 28 2020, 6:19 PM
brennen lowered the priority of this task from Unbreak Now! to Needs Triage.Apr 28 2020, 7:06 PM
brennen moved this task from Backlog to Logs/Train on the User-brennen board.
brennen added subscribers: DannyS712, thiemowmde.

I observe that, while https://www.mediawiki.org/wiki/Thread:Project:Support_desk/extension:wikibase exists, https://www.mediawiki.org/wiki/Thread:Project:Support_desk/extension:wikibase_(2) doesn't. I'm not totally clear on how the URL scheme works here, but that lines up with a fatal in Thread&canUserReply() where the title can't be retrieved:

	public function canUserReply( User $user, $rigor = PermissionManager::RIGOR_SECURE ) {
		$threadRestrictions = $this->topmostThread()->title()->getRestrictions( 'reply' );

Of relatively recent commits to the relevant code, I see some changes by @DannyS712 and @thiemowmde - CCing here in case this rings any bells.

Recognizing that this is unmaintained code, I think likely to be a low-volume issue, and likely not specific to .30, I'm unblocking the train and reducing priority on this task. Please to correct if I'm mistaken.

Change 593173 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/LiquidThreads@master] Fix bad call when a Thread does not have a root

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

Change 593174 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/LiquidThreads@master] Add many more soft PHPDoc type hints

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

I had a closer look and my impression is that this bug is not new. So why does the error show up now? I don't really know, but I have a suspicion: I think we are watching a spam bot trying to reply to posts that are not connected to a page any more, e.g. because the page got deleted.

I uploaded a quick fix that silences the error. Note this is not extensively tested, so I don't know what happens instead now. Will the spam bot be able to post? Maybe. Still I think this is the way to go for now.

Change 593173 merged by jenkins-bot:
[mediawiki/extensions/LiquidThreads@master] canUserReply: Fix bad call when a Thread does not have a root

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

Change 593174 merged by jenkins-bot:
[mediawiki/extensions/LiquidThreads@master] Add many more soft PHPDoc type hints

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

Umherirrender closed this task as Resolved.Sat, Jun 27, 8:32 PM
Umherirrender assigned this task to thiemowmde.