* (bug 31352) Fix regression causing relative block times in log display to resolve...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 6 Oct 2011 22:20:40 +0000 (22:20 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 6 Oct 2011 22:20:40 +0000 (22:20 +0000)
Revert r91770, r91786: strtotime() to resolve relative times is unsafe when the base of that relative time might have been days, months, or years ago and isn't provided to the function. :)

languages/Language.php

index b1163a6..5833f92 100644 (file)
@@ -3095,8 +3095,12 @@ class Language {
        }
 
        /**
-        * This translates the duration ("1 week", "4 days", etc)
-        * as well as the expiry time (which is an absolute timestamp).
+        * @todo Maybe translate block durations.  Note that this function is somewhat misnamed: it
+        * deals with translating the *duration* ("1 week", "4 days", etc), not the expiry time
+        * (which is an absolute timestamp). Please note: do NOT add this blindly, as it is used
+        * on old expiry lengths recorded in log entries. You'd need to provide the start date to
+        * match up with it.
+        *
         * @param $str String: the validated block duration in English
         * @return Somehow translated block duration
         * @see LanguageFi.php for example implementation
@@ -3120,8 +3124,8 @@ class Language {
                                }
                        }
                }
-               // If no duration is given, but a timestamp, display that
-               return ( strtotime( $str ) ? $this->timeanddate( strtotime( $str ) ) : $str );
+               // If all else fails, return the original string.
+               return $str;
        }
 
        /**