Page MenuHomePhabricator

Special:Institutions fails with "Error: Cannot unpack array with string keys" from CacheHelper.php
Closed, ResolvedPublicPRODUCTION ERROR

Description

[4f2a6ab873ab5447b9a19372] /wiki/Special:Institutions Error from line 353 of /var/www/wiki/mediawiki/core/includes/cache/CacheHelper.php: Cannot unpack array with string keys

Backtrace:

#0 /var/www/wiki/mediawiki/core/includes/cache/CacheHelper.php(241): CacheHelper->getCacheKeyString()
#1 /var/www/wiki/mediawiki/core/includes/cache/CacheHelper.php(186): CacheHelper->initCaching()
#2 /var/www/wiki/mediawiki/core/includes/specials/SpecialCachedPage.php(110): CacheHelper->startCache(integer, NULL)
#3 /var/www/wiki/mediawiki/extensions/EducationProgram/includes/specials/SpecialInstitutions.php(31): SpecialCachedPage->startCache(integer)
#4 /var/www/wiki/mediawiki/core/includes/specialpage/SpecialPage.php(566): EducationProgram\SpecialInstitutions->execute(NULL)
#5 /var/www/wiki/mediawiki/core/includes/specialpage/SpecialPageFactory.php(569): SpecialPage->run(NULL)
#6 /var/www/wiki/mediawiki/core/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#7 /var/www/wiki/mediawiki/core/includes/MediaWiki.php(867): MediaWiki->performRequest()
#8 /var/www/wiki/mediawiki/core/includes/MediaWiki.php(524): MediaWiki->main()
#9 /var/www/wiki/mediawiki/core/index.php(42): MediaWiki->run()
#10 {main}

Event Timeline

/var/www/wiki/mediawiki/core/includes/cache/CacheHelper.php:352:
array (size=6)
  'title' => string 'Special:Institutions' (length=20)
  0 => boolean true
  1 => boolean true
  2 => boolean false
  3 => string 'Institutions' (length=12)
  4 => string 'en-gb' (length=5)

This is from...

	protected function getCacheKey() {
		// TODO: fix session issue
		$values = $this->getRequest()->getValues();

getValues is returning...

array (size=1)
  'title' => string 'Special:Institutions' (length=20)

If we revert CacheHelper changes in Idcec077ef3fdf029b632cceafd0150851ad723e3 by @MaxSem.... https://github.com/wikimedia/mediawiki/commit/8085c58a4b675c0c11c6454bdf15b3ba61022283

wfMemcKey( ...$this->cacheKey ) goes back to call_user_func_array( 'wfMemcKey', $this->cacheKey ) the page doesn't fail on my dev wiki

So we do have a change in behaviour in MW

Krinkle renamed this task from CacheHelper.php: Cannot unpack array with string keys to Special:Institutions fails with "Error: Cannot unpack array with string keys" from CacheHelper.php: .Jul 28 2018, 8:48 PM
Krinkle renamed this task from Special:Institutions fails with "Error: Cannot unpack array with string keys" from CacheHelper.php: to Special:Institutions fails with "Error: Cannot unpack array with string keys" from CacheHelper.php.
Krinkle triaged this task as High priority.Jul 28 2018, 8:53 PM
Krinkle subscribed.

Looks like we need an array_values() there to strip out the odd title key.

Previously, call_user_func_array () was already ignoring the key, but still using its value the same way array_values() would.

https://3v4l.org/rfLQ8

Change 448950 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/core@master] Make sure to not unpack an associative array into parameter list

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

Reedy assigned this task to MaxSem.

Fixes the problem for me :)

I suspect we have a greater than 0 chance that some of the other changes will have similar problems. But can be reported/fixed separately as appropriate :)

Change 448950 merged by jenkins-bot:
[mediawiki/core@master] Make sure to not unpack an associative array into parameter list

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM