Page MenuHomePhabricator

"Undefined variable: globalUser" submitting Special:Investigate form without CentralAuth
Closed, InvalidPublicBUG REPORT

Description

What is the problem?

Submitting the Special:Investigate form on a wiki without CentralAuth, I see in the logs:

[error] [f7d4d69c1c92ecf5b9e28a69] /core/index.php/Special:Investigate   ErrorException from line 83 of /var/www/html/core/extensions/CheckUser/src/PreliminaryCheckService.php: PHP Notice: Undefined variable: globalUser
#0 /var/www/html/core/extensions/CheckUser/src/PreliminaryCheckService.php(83): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /var/www/html/core/extensions/CheckUser/src/PreliminaryCheckService.php(61): MediaWiki\CheckUser\PreliminaryCheckService->getGlobalUser(User)
#2 /var/www/html/core/extensions/CheckUser/src/PreliminaryCheckService.php(44): MediaWiki\CheckUser\PreliminaryCheckService->getAttachedWikis(User)
#3 /var/www/html/core/extensions/CheckUser/includes/specials/pagers/PreliminaryCheckPager.php(59): MediaWiki\CheckUser\PreliminaryCheckService->getPreliminaryData(array)
#4 /var/www/html/core/includes/pager/IndexPager.php(616): PreliminaryCheckPager->doQuery()
#5 /var/www/html/core/extensions/CheckUser/includes/specials/SpecialInvestigate.php(120): IndexPager->getNumRows()
#6 /var/www/html/core/includes/htmlform/HTMLForm.php(694): SpecialInvestigate->onSubmit(array, OOUIHTMLForm)
#7 /var/www/html/core/includes/htmlform/HTMLForm.php(586): HTMLForm->trySubmit()
#8 /var/www/html/core/includes/htmlform/HTMLForm.php(601): HTMLForm->tryAuthorizedSubmit()
#9 /var/www/html/core/extensions/CheckUser/includes/specials/SpecialInvestigate.php(41): HTMLForm->show()
#10 /var/www/html/core/includes/specialpage/SpecialPage.php(575): SpecialInvestigate->execute(NULL)
#11 /var/www/html/core/includes/specialpage/SpecialPageFactory.php(607): SpecialPage->run(NULL)
#12 /var/www/html/core/includes/MediaWiki.php(298): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#13 /var/www/html/core/includes/MediaWiki.php(967): MediaWiki->performRequest()
#14 /var/www/html/core/includes/MediaWiki.php(530): MediaWiki->main()
#15 /var/www/html/core/index.php(46): MediaWiki->run()
#16 {main}

I am not sure how often we will see this in the wild. It requires having CheckUser installed but not CentralAuth.

Oddly, it does not appear to prevent the form apparently submitting successfully.

Originally from T237296#5697186.

Steps to reproduce problem
  1. Find a wiki with CheckUser installed but without CentralAuth (you may need to set one up specially; I also had to cherry pick the patch from https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CheckUser/+/552269)
  2. Go to Special:Investigate
  3. Enter a valid username in the first field
  4. Enter any reason
  5. Click submit

Expected behavior: Form submits ok.
Observed behavior: Form submits ok, but there is above error in the logs.

Environment

Wiki(s): 1.35.0-alpha (5564296) 14:48, 12 December 2019

Event Timeline

Change 556760 had a related patch set uploaded (by Dmaza; owner: Dmaza):
[mediawiki/extensions/CheckUser@master] Fix undefined variable error if CentralAuth is not enabled

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

Change 556760 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] Fix undefined variable error if CentralAuth is not enabled

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

@dmaza When submitting the form, I no longer see the exception in the description.

I do see in the logs:

[error] [a1f6a48946e5e6627e35ab4d] /core/index.php?title=Special:Investigate/Preliminary_Check&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjb3JlX2RiIiwic3ViIjoiQ3plY2h1c2VyIiwiZXhwIjoxNTgxNjc5MzU2LCJkYXRhIjoiTkx3VnpHTXdTTTZvN3IxXC9uU096NmhwUkhjWT0ifQ.EJVtl2VPLT6KwLOr24dtUTy9DochJq19AoixnMQFA7Y   ErrorException from line 367 of /var/www/html/core/includes/pager/IndexPager.php: PHP Notice: Undefined index: lu_name_wiki
#0 /var/www/html/core/includes/pager/IndexPager.php(367): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /var/www/html/core/extensions/CheckUser/src/PreliminaryCheckPager.php(156): IndexPager->extractResultInfo(boolean, integer, Wikimedia\Rdbms\FakeResultWrapper)
#2 /var/www/html/core/includes/pager/IndexPager.php(695): MediaWiki\CheckUser\PreliminaryCheckPager->doQuery()
#3 /var/www/html/core/extensions/CheckUser/src/SpecialInvestigate.php(196): IndexPager->getNumRows()
#4 /var/www/html/core/extensions/CheckUser/src/SpecialInvestigate.php(75): MediaWiki\CheckUser\SpecialInvestigate->addTabContent(string)
#5 /var/www/html/core/includes/specialpage/SpecialPage.php(575): MediaWiki\CheckUser\SpecialInvestigate->execute(string)
#6 /var/www/html/core/includes/specialpage/SpecialPageFactory.php(621): SpecialPage->run(string)
#7 /var/www/html/core/includes/MediaWiki.php(298): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#8 /var/www/html/core/includes/MediaWiki.php(971): MediaWiki->performRequest()
#9 /var/www/html/core/includes/MediaWiki.php(534): MediaWiki->main()
#10 /var/www/html/core/index.php(47): MediaWiki->run()
#11 {main}
[error] [a1f6a48946e5e6627e35ab4d] /core/index.php?title=Special:Investigate/Preliminary_Check&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjb3JlX2RiIiwic3ViIjoiQ3plY2h1c2VyIiwiZXhwIjoxNTgxNjc5MzU2LCJkYXRhIjoiTkx3VnpHTXdTTTZvN3IxXC9uU096NmhwUkhjWT0ifQ.EJVtl2VPLT6KwLOr24dtUTy9DochJq19AoixnMQFA7Y   ErrorException from line 387 of /var/www/html/core/includes/pager/IndexPager.php: PHP Notice: Undefined index: lu_name_wiki
#0 /var/www/html/core/includes/pager/IndexPager.php(387): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /var/www/html/core/extensions/CheckUser/src/PreliminaryCheckPager.php(156): IndexPager->extractResultInfo(boolean, integer, Wikimedia\Rdbms\FakeResultWrapper)
#2 /var/www/html/core/includes/pager/IndexPager.php(695): MediaWiki\CheckUser\PreliminaryCheckPager->doQuery()
#3 /var/www/html/core/extensions/CheckUser/src/SpecialInvestigate.php(196): IndexPager->getNumRows()
#4 /var/www/html/core/extensions/CheckUser/src/SpecialInvestigate.php(75): MediaWiki\CheckUser\SpecialInvestigate->addTabContent(string)
#5 /var/www/html/core/includes/specialpage/SpecialPage.php(575): MediaWiki\CheckUser\SpecialInvestigate->execute(string)
#6 /var/www/html/core/includes/specialpage/SpecialPageFactory.php(621): SpecialPage->run(string)
#7 /var/www/html/core/includes/MediaWiki.php(298): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#8 /var/www/html/core/includes/MediaWiki.php(971): MediaWiki->performRequest()
#9 /var/www/html/core/includes/MediaWiki.php(534): MediaWiki->main()
#10 /var/www/html/core/index.php(47): MediaWiki->run()
#11 {main}

It does not seem to interfere with using the tool. Separate bug?

(version: CheckUser 2.5 (b8d4d55) 07:54, 13 February 2020)

@dom_walden I can't reproduce this as anymore as of 005ce473e11b7fae03643d71fa7f092ab318dd7d
Switching back to b8d4d55d8950 does shows the warning.

There was a lot of refactoring on the file that this was failing and it should be fixed now.

@dom_walden I can't reproduce this as anymore as of 005ce473e11b7fae03643d71fa7f092ab318dd7d
Switching back to b8d4d55d8950 does shows the warning.

There was a lot of refactoring on the file that this was failing and it should be fixed now.

Thanks.

There are probably other bugs when the wiki does not have CentralAuth, which I am sure will be found in time, but I will move this to done for now.