Page MenuHomePhabricator

Auth_remoteuser breaks google custom search
Closed, ResolvedPublic

Description

I'm using MediaWiki 1.27.3 and (for historical reasons) https://www.mediawiki.org/wiki/Extension:Google_Custom_Search_Engine
Yes, I know it's unmaintained - but it still works as long as I don't use Auth_remoteuser.

After enabling Auth_remoteuser, I get an error that seems to be caused by and within Auth_remoteuser:

Exception encountered, of type "Error"
[e3aef083ed85d1b95ec40776] /MediaWiki:GoogleSearch?cx=013285077636246033335%3A2wluvjftece&cof=FORID%3A10&ie=UTF-8&q=whatever&sa=Search&siteurl=en-test.opensuse.org%2FMediaWiki%3AGoogleSearch&ref=&ss= Error from line 517 of /usr/share/mediawiki_1_27/extensions/Auth_remoteuser/src/UserNameSessionProvider.php: Call to a member function isKnown() on null
Backtrace:
#0 /usr/share/mediawiki_1_27/includes/Hooks.php(195): MediaWiki\Extensions\Auth_remoteuser\UserNameSessionProvider->MediaWiki\Extensions\Auth_remoteuser\{closure}(array, Title, SkinBento)
#1 /usr/share/mediawiki_1_27/includes/skins/SkinTemplate.php(708): Hooks::run(string, array)
#2 /usr/share/mediawiki_1_27/includes/skins/SkinTemplate.php(472): SkinTemplate->buildPersonalUrls()
#3 /usr/share/mediawiki_1_27/includes/skins/SkinTemplate.php(246): SkinTemplate->prepareQuickTemplate(OutputPage)
#4 /usr/share/mediawiki_1_27/includes/OutputPage.php(2327): SkinTemplate->outputPage()
#5 /usr/share/mediawiki_1_27/includes/MediaWiki.php(743): OutputPage->output()
#6 /usr/share/mediawiki_1_27/includes/MediaWiki.php(509): MediaWiki->main()
#7 /usr/share/mediawiki_1_27/index.php(43): MediaWiki->run()
#8 {main}

Related Objects

Event Timeline

Change 358305 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Auth_remoteuser@master] Title::newFromText() can and does return null

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

The problem is Title::newFromText() can and does return null. The extension doesn't check for it. The patch above corrects that

There may be a problem with what it's storing in $this->userUrls[ 'logout' ]...

I can't obviously see where it's getting set

Ah, done by magic

					case 'userUrls':
						if ( is_array( $params[ $key ] ) ) {
							$value = $params[ $key ];
						}
						break;

Change 358307 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Auth_remoteuser@REL1_27] Title::newFromText() can and does return null

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

Change 358308 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Auth_remoteuser@REL1_28] Title::newFromText() can and does return null

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

Change 358309 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Auth_remoteuser@REL1_29] Title::newFromText() can and does return null

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

Seems like a simple fix and it will address the specific issue. Nice find!

Thanks for the quick response! I can confirm that the fix works :-) (tested on the 1.27 branch)

[question about backporting to 1.27 deleted after I noticed that you already did that ;-) ]

I have cherry picked it to all active/maintained branches. Just waiting on someone to code review it and merge them :)

Change 358305 merged by jenkins-bot:
[mediawiki/extensions/Auth_remoteuser@master] Title::newFromText() can and does return null

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

Change 358307 merged by jenkins-bot:
[mediawiki/extensions/Auth_remoteuser@REL1_27] Title::newFromText() can and does return null

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

Change 358308 merged by jenkins-bot:
[mediawiki/extensions/Auth_remoteuser@REL1_28] Title::newFromText() can and does return null

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

Change 358309 merged by jenkins-bot:
[mediawiki/extensions/Auth_remoteuser@REL1_29] Title::newFromText() can and does return null

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

Reedy claimed this task.
Reedy triaged this task as Low priority.
Reedy removed a project: Patch-For-Review.