Error
MediaWiki version: 1.35.0-wmf.28
PHP Warning: Illegal string offset 'کۆمەڵگە بڕیاری سڕینەوەی داوە'
Impact
21 of these since deploy of 1.35.0-wmf.28.
MediaWiki version: 1.35.0-wmf.28
PHP Warning: Illegal string offset 'کۆمەڵگە بڕیاری سڕینەوەی داوە'
21 of these since deploy of 1.35.0-wmf.28.
#0 /srv/mediawiki/php-1.35.0-wmf.28/includes/xml/Xml.php(563): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.28/includes/page/Article.php(1970): Xml::listDropDownOptions(string, array)
#2 /srv/mediawiki/php-1.35.0-wmf.28/includes/page/Article.php(1925): Article->confirmDelete(string)
#3 /srv/mediawiki/php-1.35.0-wmf.28/includes/actions/DeleteAction.php(41): Article->delete()
#4 /srv/mediawiki/php-1.35.0-wmf.28/includes/MediaWiki.php(519): DeleteAction->show()
#5 /srv/mediawiki/php-1.35.0-wmf.28/includes/MediaWiki.php(305): MediaWiki->performAction(Article, Title)
#6 /srv/mediawiki/php-1.35.0-wmf.28/includes/MediaWiki.php(973): MediaWiki->performRequest()
#7 /srv/mediawiki/php-1.35.0-wmf.28/includes/MediaWiki.php(535): MediaWiki->main()
#8 /srv/mediawiki/php-1.35.0-wmf.28/index.php(47): MediaWiki->run()
#9 /srv/mediawiki/w/index.php(3): require(string)
#10 {main}Analysis:
The relevant lin in Xml::listDropDownOptions() is $options[$optgroup][$opt] = $opt;. The error message tells us that the value in $options[$optgroup] is a string, not an array. $options is indeed designed to contain a mix of strings and arrays, as far as I can tell. Something is going wrong due to unexpected input.
Xml::listDropDownOptions() takes a wikitext-style nested bullet list as input. It relies on this list to be well-formed. This may not be the case for user provided content. The code in Xml::listDropDownOptions() needs to be improved to defend against that.
The input triggering the error comes from https://ckb.wikipedia.org/w/index.php?title=MediaWiki:Deletereason-dropdown.
@daniel: This is still causing logspam in wmf.39. Is there anything blocking this from making progress?
The page https://ckb.wikipedia.org/w/index.php?title=MediaWiki:Deletereason-dropdown contains a group with the default name for "Other reason" and that trigger this illegal offset.
For a wiki with content language "en" you can trigger this with:
* Other reason ** Some Reason
Gives "Warning: Illegal string offset 'Some Reason'"
The group for "Other reason" is hard coded at the begin:
if ( isset( $params['other'] ) ) {
$options[ $params['other'] ] = 'other';
}But it is not using an array to add more items. Even if I changed it to an array it results in errors later in DropdownInputWidget.php.
That means "Deletereason-dropdown" should not have the words from "filedelete-reason-otherlist" as a group.
For other dropdown boxes it should be the same for the corresponding message used for "other"
Change 611403 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Drop down lists: Do not use the value for 'other' as option group
Change 628062 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[oojs/ui@master] Fix DropdownInputWidget failing when 1st element is a group
Change 628062 merged by jenkins-bot:
[oojs/ui@master] Fix DropdownInputWidget failing when 1st element is a group
Change 611403 merged by jenkins-bot:
[mediawiki/core@master] Drop down lists: Do not use the value for 'other' as option group
Change 632805 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[mediawiki/core@master] Update OOUI to v0.40.4