Last modified: 2011-06-30 18:10:08 UTC
Files in http://commons.wikimedia.org/w/index.php?oldid=55626880 , 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 Backtrace: #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}
+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
So, two issues if I understand correctly: * We don't validate EXIF dates * We don't handle BC dates
Created attachment 8682 [details] 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.
r90421
reopening while that revision is marked FIXME
Fixed now.