From c080f51cd5d73d275dc75cfdf31bf710eaf26fe1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 6 Oct 2011 22:20:40 +0000 Subject: [PATCH] * (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. :) --- languages/Language.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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; } /** -- 2.20.1