Page MenuHomePhabricator

PHP Warning: array_key_exists() expects parameter 2 to be array, float given
Closed, ResolvedPublicBUG REPORT

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Warning: array_key_exists() expects parameter 2 to be array, float given
exception.trace
from /srv/mediawiki/php-1.39.0-wmf.17/extensions/QuickSurveys/includes/SurveyFactory.php(77)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.39.0-wmf.17/extensions/QuickSurveys/includes/SurveyFactory.php(77): array_key_exists(string, double)
#2 /srv/mediawiki/php-1.39.0-wmf.17/extensions/QuickSurveys/includes/SurveyFactory.php(41): QuickSurveys\SurveyFactory->validateUniqueName(array, array)
#3 /srv/mediawiki/php-1.39.0-wmf.17/extensions/QuickSurveys/includes/ServiceWiring.php(29): QuickSurveys\SurveyFactory->parseSurveyConfig(array)
#4 /srv/mediawiki/php-1.39.0-wmf.17/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(MediaWiki\MediaWikiServices)
#5 /srv/mediawiki/php-1.39.0-wmf.17/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
#6 /srv/mediawiki/php-1.39.0-wmf.17/includes/MediaWikiServices.php(295): Wikimedia\Services\ServiceContainer->getService(string)
#7 /srv/mediawiki/php-1.39.0-wmf.17/extensions/QuickSurveys/includes/Hooks.php(47): MediaWiki\MediaWikiServices->getService(string)
#8 /srv/mediawiki/php-1.39.0-wmf.17/includes/HookContainer/HookContainer.php(338): QuickSurveys\Hooks::onBeforePageDisplay(OutputPage, MediaWiki\Skins\Vector\SkinVectorLegacy)
#9 /srv/mediawiki/php-1.39.0-wmf.17/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#10 /srv/mediawiki/php-1.39.0-wmf.17/includes/HookContainer/HookRunner.php(943): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#11 /srv/mediawiki/php-1.39.0-wmf.17/includes/OutputPage.php(2837): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay(OutputPage, MediaWiki\Skins\Vector\SkinVectorLegacy)
#12 /srv/mediawiki/php-1.39.0-wmf.17/includes/MediaWiki.php(930): OutputPage->output(boolean)
#13 /srv/mediawiki/php-1.39.0-wmf.17/includes/MediaWiki.php(943): MediaWiki::{closure}()
#14 /srv/mediawiki/php-1.39.0-wmf.17/includes/MediaWiki.php(570): MediaWiki->main()
#15 /srv/mediawiki/php-1.39.0-wmf.17/index.php(50): MediaWiki->run()
#16 /srv/mediawiki/php-1.39.0-wmf.17/index.php(46): wfIndexMain()
#17 /srv/mediawiki/w/index.php(3): require(string)
#18 {main}
Impact
Notes

Details

Request URL
https://en.wikipedia.org/wiki/Special:BlankPage

Event Timeline

thcipriani changed the subtype of this task from "Production Error" to "Bug Report".Jun 23 2022, 8:22 PM
Zabe triaged this task as Unbreak Now! priority.EditedJun 28 2022, 2:59 PM
Zabe subscribed.

We had more than a million of these in the last hour.

T311271.png (199×677 px, 14 KB)

It seems like rOMWCd08debf9dba2: Revert "[wmf-config]: Deploy GDI Safety Survey Wave 2" wasn't completly synced?

@Zabe This ticket is really about noting the error that occurred during deployment - this change has already been reverted from production. We tried to deploy today and received the same error -> that change was also reverted. We make changes and will try again in the evening backport today.

The issue was caused by misconfiguration. The patch linked in the description was setting $wgEnabledQuickSurveys to a single survey configuration (rather than a list of survey configurations) on ptwiki.

I would prefer to V:-2 configuration changes with invalid survey configuration but this is not possible AFAIK. The next best approach is to make QuickSurveys\SurveyFactory::parseSurveyConfig() resilient to this and to log a helpful error message.

Change 844447 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/QuickSurveys@master] SurveyFactory: Log error when surveys configuration is not a list

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

Change 844447 merged by jenkins-bot:

[mediawiki/extensions/QuickSurveys@master] SurveyFactory: Log error when surveys configuration is not a list

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

phuedx claimed this task.

Being bold.