From 28e00611a7cb0f950bebe158a7c2a9d31736c4ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Fri, 13 Jan 2006 16:10:12 +0000 Subject: [PATCH] * (bug 4594) date("W", ..) is zero padded in PHP5, not so in PHP4, removing the padding --- includes/Parser.php | 4 +++- maintenance/parserTests.txt | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index c9f3d219e5..099d46df86 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1977,7 +1977,9 @@ class Parser case MAG_CURRENTTIME: return $varCache[$index] = $wgContLang->time( wfTimestamp( TS_MW, $ts ), false, false ); case MAG_CURRENTWEEK: - return $varCache[$index] = $wgContLang->formatNum( date( 'W', $ts ) ); + // @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to + // int to remove the padding + return $varCache[$index] = $wgContLang->formatNum( (int)date( 'W', $ts ) ); case MAG_CURRENTDOW: return $varCache[$index] = $wgContLang->formatNum( date( 'w', $ts ) ); case MAG_NUMBEROFARTICLES: diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 00c568ddfc..253a1bfbfd 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1413,11 +1413,11 @@ Magic Word: {{CURRENTTIME}} !! end !! test -Magic Word: {{CURRENTWEEK}} +Magic Word: {{CURRENTWEEK}} (@bug 4594) !! input {{CURRENTWEEK}} !! result -

01 +

1

!! end -- 2.20.1