From: Brion Vibber Date: Thu, 6 Oct 2011 22:20:40 +0000 (+0000) Subject: * (bug 31352) Fix regression causing relative block times in log display to resolve... X-Git-Tag: 1.31.0-rc.0~27216 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=c080f51cd5d73d275dc75cfdf31bf710eaf26fe1;p=lhc%2Fweb%2Fwiklou.git * (bug 31352) Fix regression causing relative block times in log display to resolve against current time 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. :) --- diff --git a/languages/Language.php b/languages/Language.php index b1163a640b..5833f929f0 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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; } /**