Page MenuHomePhabricator

PHP Warning from Xml.php during page deletion: Illegal string offset 'کۆمەڵگە بڕیاری سڕینەوەی داوە'
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.28

message
PHP Warning: Illegal string offset 'کۆمەڵگە بڕیاری سڕینەوەی داوە'

Impact

21 of these since deploy of 1.35.0-wmf.28.

Notes

Details

Request ID
XqibGgpAMMAAA4MIzFoAAACI
Request URL
https://ckb.wikipedia.org/w/index.php?title=%D9%88%DB%8C%DA%A9%DB%8C%D9%BE%DB%8C%D8%AF%DB%8C%D8%A7:Import_enwp/Template:Anglicise_rank&action=delete&wpReason=
Stack Trace
exception.trace
#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}
Related Changes in Gerrit:

Event Timeline

Krinkle renamed this task from Page deletion: PHP Warning: Illegal string offset 'کۆمەڵگە بڕیاری سڕینەوەی داوە' to PHP Warning from Xml.php during page deletion: Illegal string offset 'کۆمەڵگە بڕیاری سڕینەوەی داوە'.Apr 29 2020, 6:34 PM
Krinkle moved this task from Untriaged to Apr 2020 on the Wikimedia-production-error board.

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 triaged this task as Medium priority.May 1 2020, 12:08 PM

@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

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

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

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

Change 628062 merged by jenkins-bot:
[oojs/ui@master] Fix DropdownInputWidget failing when 1st element is a group

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

Change 611403 merged by jenkins-bot:
[mediawiki/core@master] Drop down lists: Do not use the value for 'other' as option group

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

Change 632805 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[mediawiki/core@master] Update OOUI to v0.40.4

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

Change 632805 merged by jenkins-bot:
[mediawiki/core@master] Update OOUI to v0.40.4

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