Last modified: 2014-11-10 18:47:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T75163, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 73163 - Exception: HTMLAutoCompleteSelectField called without any autocompletions
Exception: HTMLAutoCompleteSelectField called without any autocompletions
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
OAuth (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-08 00:06 UTC by Chris Steipp
Modified: 2014-11-10 18:47 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Chris Steipp 2014-11-08 00:06:54 UTC
On single wikis with no CentralAuth, Special:OAuthConsumerRegistration/propose throws an exception.

This has been happening for a while, since I8f2fb3aea1d628fb31464f9245c2f3aa5ad195d2.

Special:OAuthConsumerRegistration sets

'autocomplete' => array_flip( MWOAuthUtils::getAllWikiNames() ),

for the wiki field. But on single wikis, MWOAuthUtils::getAllWikiNames() returns a zero-length array, so when HTMLAutoCompleteSelectField checks if !$this->autocomplete is true, it throws the exception.

Brad, is there a way to have no autocomplete values in HTMLAutoCompleteSelectField?
Comment 1 Sam Reed (reedy) 2014-11-08 14:14:37 UTC
At a quick glance, just an empty array should work...

		if ( array_key_exists( 'autocomplete-messages', $this->mParams ) ) {
			foreach ( $this->mParams['autocomplete-messages'] as $key => $value ) {
				$key = $this->msg( $key )->plain();
				$this->autocomplete[$key] = strval( $value );
			}
		} elseif ( array_key_exists( 'autocomplete', $this->mParams ) ) {
			foreach ( $this->mParams['autocomplete'] as $key => $value ) {
				$this->autocomplete[$key] = strval( $value );
			}
		}
		if ( !is_array( $this->autocomplete ) || !$this->autocomplete ) {
			throw new MWException( 'HTMLAutoCompleteSelectField called without any autocompletions' );
		}


MWOAuthUtils::getAllWikiNames() always returns an array (even if empty)...
Comment 2 Gerrit Notification Bot 2014-11-10 17:19:39 UTC
Change 172279 had a related patch set uploaded by Anomie:
Don't offer "specific project" on Special:OAuthConsumerRegistration/propose when no other projects are available

https://gerrit.wikimedia.org/r/172279
Comment 3 Brad Jorsch 2014-11-10 17:22:21 UTC
(In reply to Sam Reed (reedy) from comment #1)
> At a quick glance, just an empty array should work...

You missed that an empty array is specifically rejected:

> 		if ( !is_array( $this->autocomplete ) || !$this->autocomplete ) {
> 			throw new MWException( 'HTMLAutoCompleteSelectField called without any
> autocompletions' );
> 		}

"!$this->autocomplete" is true if it's an empty array.

Since there's no point in offering an 'other' text field when nothing is valid as input (besides maybe duplicating the value of one of the options in the dropdown), let's just skip it altogether in that situation.
Comment 4 Gerrit Notification Bot 2014-11-10 18:47:06 UTC
Change 172279 merged by jenkins-bot:
Don't offer "specific project" on Special:OAuthConsumerRegistration/propose when no other projects are available

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links