Page MenuHomePhabricator

"Non-string key given" - error on Commons file description pages for filenames starting with strings such as JyiaH0fsTk8..
Closed, ResolvedPublic


Author: test5555

Files in , such as [[Commons:File:JyiaH0fsTk8qygiapsYgBJ6yo1_400.jpg]] display the error message below instead of a file description page. The thumbnail ok though.

Non-string key given


#0 /usr/local/apache/common-local/php-1.17/includes/GlobalFunctions.php(780): MessageCache->get(NULL, true, Object(Language))
#1 /usr/local/apache/common-local/php-1.17/includes/GlobalFunctions.php(901): wfMsgGetKey(NULL, true, Object(Language), false)
#2 /usr/local/apache/common-local/php-1.17/languages/Language.php(521): wfMsgExt(NULL, Array)
#3 /usr/local/apache/common-local/php-1.17/languages/Language.php(533): Language->getMessageFromDB(NULL)
#4 /usr/local/apache/common-local/php-1.17/languages/Language.php(807): Language->getMonthName(false)
#5 /usr/local/apache/common-local/php-1.17/languages/Language.php(1568): Language->sprintfDate('H:i, Y F j', false)
#6 /usr/local/apache/common-local/php-1.17/includes/Exif.php(740): Language->timeanddate('-00011231000227')
#7 /usr/local/apache/common-local/php-1.17/includes/media/Bitmap.php(591): FormatExif->getFormattedData()
#8 /usr/local/apache/common-local/php-1.17/includes/filerepo/File.php(926): BitmapHandler->formatMetadata(Object(LocalFile), 'a:32:{s:16:"Ima...')
#9 /usr/local/apache/common-local/php-1.17/includes/ImagePage.php(99): File->formatMetadata()
#10 /usr/local/apache/common-local/php-1.17/includes/Wiki.php(469): ImagePage->view()
#11 /usr/local/apache/common-local/php-1.17/includes/Wiki.php(69): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#12 /usr/local/apache/common-local/php-1.17/index.php(114): MediaWiki->performRequestForTitle(Object(Title), Object(ImagePage), Object(OutputPage), Object(User), Object(WebRequest))
#13 /usr/local/apache/common-local/live-1.5/index.php(3): require('/usr/local/apac...')
#14 {main}

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:26 PM
bzimport set Reference to bz29471.

Bryan.TongMinh wrote:

+cc Brian for metadata madness :)

Basic issue is MediaWiki doesn't like the years before Jesus is born.

What is happening:
*File is listed as being created on 0000:01:00 00:02:27 - which is really malformed, because in exif date format, days start at 01, not 00. So mediawiki interprets that as the -1'th of January, aka the 31st of December: -0001:12:31 00:02:27
*Converted to mediawiki ts format, that's -00011231000227
*Converted to MediaWiki ts format again, wfTimestamp seems not to like negative dates in MW format. Returns false.
*Language::sprintfDate barfs on false

Bryan.TongMinh wrote:

So, two issues if I understand correctly:

  • We don't validate EXIF dates
  • We don't handle BC dates

Bryan.TongMinh wrote:

Validate return value of wfTimestamp

Patch which should fix this issue in 1.19.

I suggest to add a test case to phpunit before this is committed.


yep, that works.

I tried experimenting with adding support to BC dates to Language::timeanddate and friends, but it starts to get messy with lots of assumptions about the parts of the date correspond to specific character positions in the string, so just checking the dates are positive years is probably good enough.

reopening while that revision is marked FIXME

Gilles raised the priority of this task from High to Unbreak Now!.Dec 4 2014, 10:19 AM
Gilles added a project: Multimedia.
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to High.Dec 4 2014, 11:22 AM