Page MenuHomePhabricator

Stop extending PermissionManager service
Open, HighPublic

Description

The PermissionManager is not stable to extend, the constructor is changing when new dependencies are needed, that breaks UserProtectPermissionManager in extension UserProtect

https://codesearch.wmcloud.org/search/?q=extends%5Cs%2B%5C%5C%3FPermissionManager&i=nope&files=&repos=

Event Timeline

Kizule added a subscriber: Kizule.

I have one idea. Let's try.

Kizule moved this task from Inbox to Watching on the User-Kizule board.

I'm not sure that my idea would work, so I'm removing the assignee.

Kizule triaged this task as High priority.Thu, Mar 25, 9:58 PM

Failures are still happening:

22:53:46 [4a1cb435226e2f2abf33b654] [no req]   TypeError: Argument 5 passed to MediaWiki\Permissions\PermissionManager::__construct() must be an instance of MediaWiki\Permissions\GroupPermissionsLookup, instance of MediaWiki\Block\BlockErrorFormatter given, called in /workspace/src/extensions/UserProtect/includes/UserProtectHooks.php on line 63
22:53:46 Backtrace:
22:53:46 from /workspace/src/includes/Permissions/PermissionManager.php(220)
22:53:46 #0 /workspace/src/extensions/UserProtect/includes/UserProtectHooks.php(63): MediaWiki\Permissions\PermissionManager->__construct(MediaWiki\Config\ServiceOptions, MediaWiki\SpecialPage\SpecialPageFactory, MediaWiki\Revision\RevisionStore, NamespaceInfo, MediaWiki\Block\BlockErrorFormatter, MediaWiki\HookContainer\HookContainer, UserCache)
22:53:46 #1 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php(447): UserProtectHooks::{closure}(MediaWiki\MediaWikiServices)
22:53:46 #2 /workspace/src/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
22:53:46 #3 /workspace/src/includes/MediaWikiServices.php(263): Wikimedia\Services\ServiceContainer->getService(string)
22:53:46 #4 /workspace/src/includes/MediaWikiServices.php(1231): MediaWiki\MediaWikiServices->getService(string)
22:53:46 #5 /workspace/src/includes/ServiceWiring.php(1501): MediaWiki\MediaWikiServices->getPermissionManager()
22:53:46 #6 /workspace/src/includes/user/UserGroupManager.php(815): MediaWikiIntegrationTestCase::{closure}(User)
22:53:46 #7 /workspace/src/includes/user/User.php(3041): MediaWiki\User\UserGroupManager->addUserToGroup(User, string, NULL, boolean)
22:53:46 #8 /workspace/src/tests/phpunit/includes/TestUser.php(74): User->addGroup(string)
22:53:46 #9 /workspace/src/tests/phpunit/includes/TestUserRegistry.php(85): TestUser->__construct(string, string, string, array, string)
22:53:46 #10 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php(213): TestUserRegistry::getImmutableTestUser(array)
22:53:46 #11 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php(236): MediaWikiIntegrationTestCase::getTestUser(array)
22:53:46 #12 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php(1412): MediaWikiIntegrationTestCase::getTestSysop()
22:53:46 #13 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php(433): MediaWikiIntegrationTestCase->addCoreDBData()
22:53:46 #14 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(627): MediaWikiIntegrationTestCase->run(PHPUnit\Framework\TestResult)
22:53:46 #15 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(627): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
22:53:46 #16 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(627): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
22:53:46 #17 /workspace/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(656): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
22:53:46 #18 /workspace/src/vendor/phpunit/phpunit/src/TextUI/Command.php(236): PHPUnit\TextUI\TestRunner->doRun(PHPUnit\Framework\TestSuite, array, array, boolean)
22:53:46 #19 /workspace/src/tests/phpunit/phpunit.php(75): PHPUnit\TextUI\Command->run(array, boolean)
22:53:46 #20 /workspace/src/maintenance/doMaintenance.php(112): PHPUnitMaintClass->execute()
22:53:46 #21 /workspace/src/tests/phpunit/phpunit.php(134): require_once(string)
22:53:46 #22 {main}

This should be resolved asap.

It is not enough to just fix the current failure as the next can coming when core changes again its PermissionManager class.