Page MenuHomePhabricator

PHP Notice: Array to string conversion
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.37.0-wmf.7

message
PHP Notice: Array to string conversion

from /srv/mediawiki/php-1.37.0-wmf.7/languages/Language.php(3522)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.37.0-wmf.7/languages/Language.php(3522): implode(string, array)
#2 /srv/mediawiki/php-1.37.0-wmf.7/includes/actions/InfoAction.php(771): Language->commaList(array)
#3 /srv/mediawiki/php-1.37.0-wmf.7/includes/actions/InfoAction.php(505): InfoAction->getNamespaceProtectionMessage(Title)
#4 /srv/mediawiki/php-1.37.0-wmf.7/includes/actions/InfoAction.php(129): InfoAction->pageInfo()
#5 /srv/mediawiki/php-1.37.0-wmf.7/includes/actions/FormlessAction.php(48): InfoAction->onView()
#6 /srv/mediawiki/php-1.37.0-wmf.7/includes/MediaWiki.php(536): FormlessAction->show()
#7 /srv/mediawiki/php-1.37.0-wmf.7/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#8 /srv/mediawiki/php-1.37.0-wmf.7/includes/MediaWiki.php(917): MediaWiki->performRequest()
#9 /srv/mediawiki/php-1.37.0-wmf.7/includes/MediaWiki.php(551): MediaWiki->main()
#10 /srv/mediawiki/php-1.37.0-wmf.7/index.php(53): MediaWiki->run()
#11 /srv/mediawiki/php-1.37.0-wmf.7/index.php(46): wfIndexMain()
#12 /srv/mediawiki/w/index.php(3): require(string)
#13 {main}

Impact

Guess: "Array" displayed on an interface message on action=info on pages for some namespaces on some wikis.

Notes

Details

Request URL
https://www.mediawiki.org/w/index.php?title=Translations:Help:Subpages/Page_display_title/en&action=info

Event Timeline

I think the issue is here: https://gerrit.wikimedia.org/g/mediawiki/core/+/948abe3cf0fbc1bf2499c1e44a0814737cd3a738/includes/actions/InfoAction.php#765

I think wgNamespaceProtection now contains a list of rights for a namespace (which is allowed per documentation as far as I can see). I could not find such configuration from code search, but could be combination of such values. Looks like the code does not handle that case.

This code was introduced in rMWd67cd9bae03a: Make InfoAction take namespace protection into account

Indeed, .phan/config.php includes:

'wgNamespaceProtection' => 'array<string,string|string[]>'

A simple cast should fix that.

Change 695319 had a related patch set uploaded (by Matěj Suchánek; author: Matěj Suchánek):

[mediawiki/core@master] InfoAction: Cast wgNamespaceProtection to array

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

Change 695319 merged by jenkins-bot:

[mediawiki/core@master] InfoAction: Cast wgNamespaceProtection to array

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

Change 695322 had a related patch set uploaded (by Jforrester; author: Matěj Suchánek):

[mediawiki/core@wmf/1.37.0-wmf.7] InfoAction: Cast wgNamespaceProtection to array

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

Change 695322 merged by jenkins-bot:

[mediawiki/core@wmf/1.37.0-wmf.7] InfoAction: Cast wgNamespaceProtection to array

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

Mentioned in SAL (#wikimedia-operations) [2021-06-02T11:27:03Z] <urbanecm@deploy1002> Synchronized php-1.37.0-wmf.7/includes/actions/InfoAction.php: 85feaa15d9bbda130541adb6302f31c4372e6519: InfoAction: Cast wgNamespaceProtection to array (T283751) (duration: 01m 00s)

matej_suchanek claimed this task.

The URL now displays:

Allow only users with "translate" permission