Page MenuHomePhabricator

TypeError: Argument 1 passed to MediaWiki\Auth\Throttler::__construct() must be of the type array or null, integer given
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Trying to edit a page on Beta, I get the error:

[YmfHz0ZwB5FpUmg-QzQZwAAAABE] /w/index.php?title=Cat&action=edit TypeError: Argument 1 passed to MediaWiki\Auth\Throttler::__construct() must be of the type array or null, integer given, called in /srv/mediawiki/php-master/includes/ServiceWiring.php on line 1839

Backtrace:

from /srv/mediawiki/php-master/includes/auth/Throttler.php(64)
#0 /srv/mediawiki/php-master/includes/ServiceWiring.php(1839): MediaWiki\Auth\Throttler->__construct(integer, array)
#1 /srv/mediawiki/php-master/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(MediaWiki\MediaWikiServices)
#2 /srv/mediawiki/php-master/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
#3 /srv/mediawiki/php-master/includes/MediaWikiServices.php(301): Wikimedia\Services\ServiceContainer->getService(string)
#4 /srv/mediawiki/php-master/includes/MediaWikiServices.php(1742): MediaWiki\MediaWikiServices->getService(string)
#5 /srv/mediawiki/php-master/includes/EditPage.php(503): MediaWiki\MediaWikiServices->getTempUserCreator()
#6 /srv/mediawiki/php-master/includes/actions/EditAction.php(69): EditPage->__construct(Article)
#7 /srv/mediawiki/php-master/includes/MediaWiki.php(546): EditAction->show()
#8 /srv/mediawiki/php-master/includes/MediaWiki.php(322): MediaWiki->performAction(Article, Title)
#9 /srv/mediawiki/php-master/includes/MediaWiki.php(912): MediaWiki->performRequest()
#10 /srv/mediawiki/php-master/includes/MediaWiki.php(566): MediaWiki->main()
#11 /srv/mediawiki/php-master/index.php(50): MediaWiki->run()
#12 /srv/mediawiki/php-master/index.php(46): wfIndexMain()
#13 /srv/mediawiki/w/index.php(3): require(string)
#14 {main}
Steps to reproduce problem
  1. https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Cat&action=edit
Environment

Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.39.0-alpha (df2b1ee) 10:01, 26 April 2022.
Editor: WikiEditor 0.5.3 (45a8a07) 06:19, 25 April 2022.

Event Timeline

Looks like a correct guess to me (I can edit locally with this patch and its merged child reverted). The breaking patch is only in master, so re-classifying as wmf.10 blocker

Lucas_Werkmeister_WMDE lowered the priority of this task from Unbreak Now! to High.Apr 26 2022, 2:31 PM

The breaking patch is only in master, so re-classifying as wmf.10 blocker

Lowering priority slightly in that case, as it’s not a blocker for the current train.

The instantiator callback for TempUserCreator creates a Throttler based on th AccountCreationThrottle setting, which it extepcts to be a list of throttle specs:

			new Throttler(
				$services->getMainConfig()->get( 'AccountCreationThrottle' ),
				[
					'type' => 'acctcreate',
					'cache' => $services->getLocalServerObjectCache()
				]
			)

Per MainConfigSchema, AccountCreationThrottle is a list of throttle specs:

	 $wgAccountCreationThrottle = [
	  // no more than 100 per month
	  [
	   'count' => 100,
	   'seconds' => 30*86400,
	  ],
	  // no more than 10 per day
	  [
	   'count' => 10,
	   'seconds' => 86400,
	  ],
	 ];

But InitialiseSettings.php has:
'wgAccountCreationThrottle' => [
'default' => 6,
'private' => 0, disable for wikis with sysop-only account creation
'fishbowl' => 0,
'eswikiquote' => 1,
T230796
'hewikibooks' => 4,
'hewikinews' => 4,
'hewikiquote' => 4,
'hewikisource' => 4,
'hewiktionary' => 4,
],

This causes to be a single int, not a list of throttles.

ThrottlePreAuthenticationProvider has this workaround:

		// Handle old $wgAccountCreationThrottle format (number of attempts per 24 hours)
		if ( !is_array( $accountCreationThrottle ) ) {
			$accountCreationThrottle = [ [
				'count' => $accountCreationThrottle,
				'seconds' => 86400,
			] ];
		}

I suppose the instantiator callback for TempUserCreator needs to have the same workaround. Or we fix InitializeSettings.php.

Change 786368 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] TempUserCreator: Support old format of AccountCreationThrottle

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

Change 786368 merged by jenkins-bot:

[mediawiki/core@master] TempUserCreator: Support old format of AccountCreationThrottle

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

Automatic code updates on Beta seem to be broken again :/

Automatic code updates on Beta seem to be broken again :/

They are working again now. Thanks for pointing this out.

tstarling claimed this task.