Page MenuHomePhabricator

Error: Call to undefined method MediaWiki\Extension\GlobalBlocking\GlobalBlock::getParentBlockId()
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

What is the problem?

Attempting to access a few beta wikis, I am seeing:

[ZyHU6DqK5bw8gmy-hyPtlwAAAJI] /wiki/Main_Page Error: Call to undefined method MediaWiki\Extension\GlobalBlocking\GlobalBlock::getParentBlockId()

Backtrace:

from /srv/mediawiki/php-master/includes/block/BlockManager.php(537)
#0 /srv/mediawiki/php-master/includes/block/BlockManager.php(354): MediaWiki\Block\BlockManager->getUniqueBlocks(array)
#1 /srv/mediawiki/php-master/includes/block/BlockManager.php(287): MediaWiki\Block\BlockManager->createGetBlockResult(string, array)
#2 /srv/mediawiki/php-master/includes/Permissions/PermissionManager.php(853): MediaWiki\Block\BlockManager->getCreateAccountBlock(MediaWiki\User\User, MediaWiki\Request\WebRequest, bool)
#3 /srv/mediawiki/php-master/includes/Permissions/PermissionManager.php(787): MediaWiki\Permissions\PermissionManager->getApplicableBlock(string, MediaWiki\User\User, string, MediaWiki\Title\Title, MediaWiki\Request\WebRequest)
#4 /srv/mediawiki/php-master/includes/Permissions/PermissionManager.php(507): MediaWiki\Permissions\PermissionManager->checkUserBlock(string, MediaWiki\User\User, MediaWiki\Permissions\PermissionStatus, string, bool, MediaWiki\Title\Title)
#5 /srv/mediawiki/php-master/includes/Permissions/UserAuthority.php(373): MediaWiki\Permissions\PermissionManager->getPermissionStatus(string, MediaWiki\User\User, MediaWiki\Title\Title, string)
#6 /srv/mediawiki/php-master/includes/Permissions/UserAuthority.php(256): MediaWiki\Permissions\UserAuthority->internalCan(string, string, MediaWiki\Title\Title, MediaWiki\Permissions\PermissionStatus, int)
#7 /srv/mediawiki/php-master/includes/user/User.php(3324): MediaWiki\Permissions\UserAuthority->authorizeWrite(string, MediaWiki\Title\Title, MediaWiki\Permissions\PermissionStatus)
#8 /srv/mediawiki/php-master/includes/auth/AuthManager.php(2208): MediaWiki\User\User->authorizeWrite(string, MediaWiki\Title\Title, MediaWiki\Permissions\PermissionStatus)
#9 /srv/mediawiki/php-master/includes/auth/AuthManager.php(1267): MediaWiki\Auth\AuthManager::MediaWiki\Auth\{closure}(string, MediaWiki\Title\Title, MediaWiki\Permissions\PermissionStatus)
#10 /srv/mediawiki/php-master/includes/auth/AuthManager.php(2210): MediaWiki\Auth\AuthManager->authorizeInternal(Closure, string)
#11 /srv/mediawiki/php-master/includes/auth/AuthManager.php(2034): MediaWiki\Auth\AuthManager->authorizeAutoCreateAccount(MediaWiki\User\User)
#12 /srv/mediawiki/php-master/includes/Setup.php(588): MediaWiki\Auth\AuthManager->autoCreateUser(MediaWiki\User\User, string, bool, bool, MediaWiki\User\User)
#13 /srv/mediawiki/php-master/includes/WebStart.php(85): require_once(string)
#14 /srv/mediawiki/php-master/index.php(50): require(string)
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}

So far, it occurs on enwiki, arwiki, bnwiki, cswiki but not on dewiki, dewiktionary, enwiktionary, enwikibooks, enrtlwiki.

I can reproduce this locally by trying to create an account while autoblocked if the autoblock disallows account creation. So far, only while logged out (anonymous user).

I might be seeing it on every page on beta because it is trying to autocreate a temp account.

Steps to reproduce problem
  1. Do an edit on https://de.wikipedia.beta.wmflabs.org to create a temporary account. Keep the browser session open for later.
  2. In a different browser, login as a steward. Global block the temporary account from step 1. Check "Globally disable account creation" and "Automatically globally block the last IP address...".
  3. Check that an autoblock has been created. If not, you might need to attempt an edit with the temp account from step 1 again.
  4. As the temp account from step 1, log out (end the session) then attempt to create an account (e.g. Special:CreateAccount).
Environment

Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.44.0-alpha (9b0c5e4) 01:15, 30 October 2024. GlobalBlocking – (8437e52) 15:43, 29 October 2024.

Event Timeline

Dreamy_Jazz subscribed.

This is a bug from core from what I can tell.

The code https://gerrit.wikimedia.org/g/mediawiki/core/+/e438c515bf9390dcb8cb2049298deb0f087439bb/includes/block/BlockManager.php#537 will assume that blocks must be an instance of DatabaseBlock if it can be an autoblock. This is not the case, so the code should probably check that the method exists before trying to call it.

We probably do want to implement that method, but the fix for this bug is in core.

Change #1084741 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Don't assume autoblock objects have ::getParentBlockId method

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

Change #1084761 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@wmf/1.44.0-wmf.1] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Change #1084762 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@wmf/1.43.0-wmf.28] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Change #1084741 merged by jenkins-bot:

[mediawiki/core@master] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Change #1084762 merged by jenkins-bot:

[mediawiki/core@wmf/1.43.0-wmf.28] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Mentioned in SAL (#wikimedia-operations) [2024-10-30T13:50:52Z] <urbanecm@deploy2002> Started scap sync-world: Backport for [[gerrit:1084762|[BlockManager] Don't assume autoblocks have ::getParentBlockId (T378563)]], [[gerrit:1084729|CirrusSearch: Enable offloading weighted tags via EventBus (T377150)]], [[gerrit:1084779|cswiki: Add celebration logo (T378597)]]

Mentioned in SAL (#wikimedia-operations) [2024-10-30T13:53:20Z] <urbanecm@deploy2002> dreamyjazz, pfischer, urbanecm: Backport for [[gerrit:1084762|[BlockManager] Don't assume autoblocks have ::getParentBlockId (T378563)]], [[gerrit:1084729|CirrusSearch: Enable offloading weighted tags via EventBus (T377150)]], [[gerrit:1084779|cswiki: Add celebration logo (T378597)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-10-30T14:06:22Z] <urbanecm@deploy2002> Finished scap sync-world: Backport for [[gerrit:1084762|[BlockManager] Don't assume autoblocks have ::getParentBlockId (T378563)]], [[gerrit:1084729|CirrusSearch: Enable offloading weighted tags via EventBus (T377150)]], [[gerrit:1084779|cswiki: Add celebration logo (T378597)]] (duration: 15m 30s)

Change #1084761 merged by jenkins-bot:

[mediawiki/core@wmf/1.44.0-wmf.1] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Mentioned in SAL (#wikimedia-operations) [2024-10-30T14:19:23Z] <dreamyjazz@deploy2002> Started scap sync-world: Backport for [[gerrit:1084761|[BlockManager] Don't assume autoblocks have ::getParentBlockId (T378563)]], [[gerrit:1084152|[GlobalBlocking] Enable global autoblocks on all WMF wikis (T377760)]]

Mentioned in SAL (#wikimedia-operations) [2024-10-30T14:21:47Z] <dreamyjazz@deploy2002> dreamyjazz: Backport for [[gerrit:1084761|[BlockManager] Don't assume autoblocks have ::getParentBlockId (T378563)]], [[gerrit:1084152|[GlobalBlocking] Enable global autoblocks on all WMF wikis (T377760)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

@Dreamy_Jazz I think this change means autoblocks won't block account creation, even when they should.

Mentioned in SAL (#wikimedia-operations) [2024-10-30T14:28:33Z] <dreamyjazz@deploy2002> Finished scap sync-world: Backport for [[gerrit:1084761|[BlockManager] Don't assume autoblocks have ::getParentBlockId (T378563)]], [[gerrit:1084152|[GlobalBlocking] Enable global autoblocks on all WMF wikis (T377760)]] (duration: 09m 10s)

@Dreamy_Jazz I think this change means autoblocks won't block account creation, even when they should.

Ah, I see. I'll make a fix for that.

Change #1084814 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Fix bug in BlockManager::getUniqueBlocks

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

Change #1084831 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@wmf/1.44.0-wmf.1] Fix bug in BlockManager::getUniqueBlocks

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

Change #1084834 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@wmf/1.43.0-wmf.28] Fix bug in BlockManager::getUniqueBlocks

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

Change #1084831 merged by jenkins-bot:

[mediawiki/core@wmf/1.44.0-wmf.1] Fix bug in BlockManager::getUniqueBlocks

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

Mentioned in SAL (#wikimedia-operations) [2024-10-30T16:01:56Z] <dreamyjazz@deploy2002> Started scap sync-world: Backport for [[gerrit:1084831|Fix bug in BlockManager::getUniqueBlocks (T378563)]]

I'll merge the wmf.28 backport later, as a flaky selenium test caused failures and meant I can't be around for when it does merge.

Mentioned in SAL (#wikimedia-operations) [2024-10-30T16:04:17Z] <dreamyjazz@deploy2002> dreamyjazz: Backport for [[gerrit:1084831|Fix bug in BlockManager::getUniqueBlocks (T378563)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-10-30T16:09:02Z] <dreamyjazz@deploy2002> Finished scap sync-world: Backport for [[gerrit:1084831|Fix bug in BlockManager::getUniqueBlocks (T378563)]] (duration: 07m 06s)

Change #1084814 merged by jenkins-bot:

[mediawiki/core@master] Fix bug in BlockManager::getUniqueBlocks

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

Change #1084834 merged by jenkins-bot:

[mediawiki/core@wmf/1.43.0-wmf.28] Fix bug in BlockManager::getUniqueBlocks

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

Mentioned in SAL (#wikimedia-operations) [2024-10-30T21:18:36Z] <dreamyjazz@deploy2002> Started scap sync-world: Backport for [[gerrit:1084834|Fix bug in BlockManager::getUniqueBlocks (T378563)]]

Mentioned in SAL (#wikimedia-operations) [2024-10-30T21:21:00Z] <dreamyjazz@deploy2002> dreamyjazz: Backport for [[gerrit:1084834|Fix bug in BlockManager::getUniqueBlocks (T378563)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-10-30T21:25:58Z] <dreamyjazz@deploy2002> Finished scap sync-world: Backport for [[gerrit:1084834|Fix bug in BlockManager::getUniqueBlocks (T378563)]] (duration: 07m 22s)

I cannot reproduce the exception from the description, and autoblocks do correctly block account creations.

Change #1224125 had a related patch set uploaded (by Reedy; author: Dreamy Jazz):

[mediawiki/core@REL1_43] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Restricted Application added a subscriber: hubaishan. · View Herald Transcript
Restricted Application added a subscriber: alaa. · View Herald TranscriptJan 7 2026, 4:32 PM

Change #1224126 had a related patch set uploaded (by Reedy; author: Dreamy Jazz):

[mediawiki/core@REL1_43] Fix bug in BlockManager::getUniqueBlocks

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

Change #1224125 merged by jenkins-bot:

[mediawiki/core@REL1_43] [BlockManager] Don't assume autoblocks have ::getParentBlockId

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

Change #1224126 merged by jenkins-bot:

[mediawiki/core@REL1_43] Fix bug in BlockManager::getUniqueBlocks

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