Page MenuHomePhabricator

Error on Special:BlockList if there's a partial block against a page that is deleted
Closed, ResolvedPublic

Description

The problem is in BlockListPager::preprocessResults:

foreach ( $this->restrictions as $restriction ) {
	if ( $restriction->getType() === PageRestriction::TYPE ) {
		'@phan-var PageRestriction $restriction';
		$title = $restriction->getTitle();
		if ( $title !== null ) {
			$lb->addObj( $title );
		}
	}
}

$restriction->getTitle(); can return false, and calling $lb->addObj( false ) causes an error when addObj asserts the type. This assertion was added recently and is only in master as of yet: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/682144/3/includes/cache/LinkBatch.php

I'd expect production errors if we don't fix this before the next branch cut.

We should ensure that we only ever pass a LinkTarget to LinkBatch::addObj.

Event Timeline

Change 683413 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/core@master] BlockListPager: Ensure false is not passed to LinkBatch::addObj

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

Change 683413 merged by jenkins-bot:

[mediawiki/core@master] BlockListPager: Ensure false is not passed to LinkBatch::addObj

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

dom_walden subscribed.

I cannot reproduce this on https://en.wikipedia.beta.wmflabs.org MediaWiki 1.37.0-alpha (7ad7610) 05:22, 30 April 2021.