Merge "Followup I888c616e: Keep IRC line format unchanged."
[lhc/web/wiklou.git] / includes / media / FormatMetadata.php
index 6914402..d44dfd1 100644 (file)
@@ -104,10 +104,16 @@ class FormatMetadata {
                                        . ':' . str_pad( intval( $m[0] / $m[1] ), 2, '0', STR_PAD_LEFT )
                                        . ':' . str_pad( intval( $s[0] / $s[1] ), 2, '0', STR_PAD_LEFT );
 
-                               $time = wfTimestamp( TS_MW, '1971:01:01 ' . $tags[$tag] );
-                               // the 1971:01:01 is just a placeholder, and not shown to user.
-                               if ( $time && intval( $time ) > 0 ) {
-                                       $tags[$tag] = $wgLang->time( $time );
+                               try {
+                                       $time = wfTimestamp( TS_MW, '1971:01:01 ' . $tags[$tag] );
+                                       // the 1971:01:01 is just a placeholder, and not shown to user.
+                                       if ( $time && intval( $time ) > 0 ) {
+                                               $tags[$tag] = $wgLang->time( $time );
+                                       }
+                               } catch ( TimestampException $e ) {
+                                       // This shouldn't happen, but we've seen bad formats
+                                       // such as 4-digit seconds in the wild.
+                                       // leave $tags[$tag] as-is
                                }
                                continue;
                        }
@@ -1114,7 +1120,7 @@ class FormatMetadata {
         * @param $val String: The 8 digit news code.
         * @return string The human readable form
         */
-       static private function convertNewsCode( $val ) {
+       private static function convertNewsCode( $val ) {
                if ( !preg_match( '/^\d{8}$/D', $val ) ) {
                        // Not a valid news code.
                        return $val;
@@ -1355,7 +1361,7 @@ class FormatExif {
         * @param $meta array
         */
        function FormatExif( $meta ) {
-               wfDeprecated(__METHOD__);
+               wfDeprecated( __METHOD__, '1.18' );
                $this->meta = $meta;
        }