Page MenuHomePhabricator

HTMLMultiSelectField::getInputOOUI generates a warnig if empty list and empty default
Closed, DuplicatePublic

Description

The logic in HTMLMultiSelectField::getInputOOUI

		if ( !$hasSections ) {
			// Directly return the only OOUI\CheckboxMultiselectInputWidget.
			// This allows it to be made infusable and later tweaked by JS code.
			return $out[ 0 ];
		}

(https://github.com/wikimedia/mediawiki/commit/a81db83d79868c9587c534eb37e216e24bfa914c#diff-ca67d99b5d57ec5f12f3aae9edb089dbR208)

points to a nonexisting element if no defaults are selected and the list is empty (there is no 0-th element). This generates a warning, which might generate output... Maybe this should become a test case for this class...