MediaWiki doesn't handle BC dates nicely, so check for that.
* Do not try to group together a page creation and edit in the RSS feed of RC.
* (bug 29342) Patrol preferences shouldn't be visible to users who don't have
patrol permissions
+* (bug 29471) Exception thrown for files with invalid date in metadata
=== API changes in 1.19 ===
* BREAKING CHANGE: action=watch now requires POST and token.
$time = wfTimestamp( TS_MW, '1971:01:01 ' . $tags[$tag] );
// the 1971:01:01 is just a placeholder, and not shown to user.
- if ( $time ) {
+ if ( $time && intval( $time ) > 0 ) {
$tags[$tag] = $wgLang->time( $time );
}
continue;
$val = wfMsg( 'exif-unknowndate' );
} elseif ( preg_match( '/^(?:\d{4}):(?:\d\d):(?:\d\d) (?:\d\d):(?:\d\d):(?:\d\d)$/D', $val ) ) {
$time = wfTimestamp( TS_MW, $val );
- if ( $time ) {
+ if ( $time && intval( $time ) > 0 ) {
$val = $wgLang->timeanddate( $time );
}
} elseif ( preg_match( '/^(?:\d{4}):(?:\d\d):(?:\d\d)$/D', $val ) ) {
. substr( $val, 5, 2 )
. substr( $val, 8, 2 )
. '000000' );
- if ( $time ) {
+ if ( $time && intval( $time ) > 0 ) {
$val = $wgLang->date( $time );
}
}
--- /dev/null
+<?php
+class FormatMetadataTest extends MediaWikiTestCase {
+ public function testInvalidDate() {
+ $file = UnregisteredLocalFile::newFromPath( dirname( __FILE__ ) .
+ '/broken_exif_date.jpg', 'image/jpeg' );
+
+ // Throws an error if bug hit
+ $meta = $file->formatMetadata();
+
+ // Find date exif entry
+ $this->assertArrayHasKey( 'visible', $meta );
+ $dateIndex = null;
+ foreach ( $meta['visible'] as $i => $data ) {
+ if ( $data['id'] == 'exif-datetimeoriginal' ) {
+ $dateIndex = $i;
+ }
+ }
+ $this->assertNotNull( $dateIndex, 'Date entry exists in metadata' );
+ $this->assertEquals( '0000:01:00 00:02:27',
+ $meta['visible'][$dateIndex]['value'],
+ 'File with invalid date metadata (bug 29471)' );
+ }
+}
\ No newline at end of file