Steps to replicate the issue (include links if applicable):
- Deploy new MediaWiki site on 1.43 and initialize database using install.php
- Install Auth_remoteuser extension from REL1_43 branch
- Add the following to LocalSettings.php and try browsing to the site:
wfLoadExtension( 'Auth_remoteuser');
$wgGroupPermissions['*']['createaccount']= false;
$wgGroupPermissions['*']['autocreateaccount'] = true;
$wgGroupPermissions['*']['edit'] = false;
if( function_exists('apache_request_headers') ) {
$wgAuthRemoteuserUserName = apache_request_headers()['REMOTE_USER'];
} else {
$wgAuthRemoteuserUserName = '';
}
$wgAuthRemoteuserUserNameReplaceFilter = [
'@MYDOMAIN.COM$' =>''
];
ini_set( 'display_errors', 1 );
$wgShowDBErrorBacktrace = true;
$wgShowExceptionDetails = true;What happens?:
Browsing to a page results in this message:
[e0395375db81ffbf0540d309] /main/Main_Page Error: Typed property MediaWiki\Extension\Auth_remoteuser\AuthRemoteuserSessionProvider::$hookContainer must not be accessed before initialization
Backtrace:
from /var/www/html/extensions/Auth_remoteuser/src/AuthRemoteuserSessionProvider.php(247)
#0 /var/www/html/extensions/Auth_remoteuser/src/AuthRemoteuserSessionProvider.php(113): MediaWiki\Extension\Auth_remoteuser\AuthRemoteuserSessionProvider->setUserNameReplaceFilter(array)
#1 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(240): MediaWiki\Extension\Auth_remoteuser\AuthRemoteuserSessionProvider->__construct(MediaWiki\Config\GlobalVarConfig, MediaWiki\HookContainer\HookContainer, MediaWiki\User\Options\UserOptionsManager)
#2 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(149): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec(array, array)
#3 /var/www/html/includes/session/SessionManager.php(482): Wikimedia\ObjectFactory\ObjectFactory->createObject(array)
#4 /var/www/html/includes/session/SessionManager.php(541): MediaWiki\Session\SessionManager->getProviders()
#5 /var/www/html/includes/session/SessionManager.php(248): MediaWiki\Session\SessionManager->getSessionInfoForRequest(MediaWiki\Request\WebRequest)
#6 /var/www/html/includes/Request/WebRequest.php(867): MediaWiki\Session\SessionManager->getSessionForRequest(MediaWiki\Request\WebRequest)
#7 /var/www/html/includes/session/SessionManager.php(167): MediaWiki\Request\WebRequest->getSession()
#8 /var/www/html/includes/Setup.php(492): MediaWiki\Session\SessionManager::getGlobalSession()
#9 /var/www/html/includes/WebStart.php(85): require_once(string)
#10 /var/www/html/index.php(50): require(string)
#11 {main}What should have happened instead?:
UserNameReplaceFilter works and strips Kerberos principal from my username.
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
1.43.0, using REL1_43 branch of Auth_remoteuser extension
Other information (browser name/version, screenshots, etc.):
Encountered this while testing an upgrade from 1.39 to 1.43 of a site using this extension, but was able to reproduce the issue on a fresh install with no other extensions enabled.
Confirmed that removing $wgAuthRemoteuserUserNameReplaceFilter avoids the problem, and also confirmed that $wgAuthRemoteuserUserNameBlacklistFilter and
$wgAuthRemoteuserUserNameWhitelistFilter both appear to result in the same behavior, so I am generalizing my issue to the AuthRemoteuserFilterUserName hook.
Looking through code history, f2ed3cc seems like it may be relevant, but I'm not familiar enough with the underlying HookContainer functionality to determine what exactly is going wrong.