From: Ævar Arnfjörð Bjarmason Date: Fri, 13 Jan 2006 16:10:12 +0000 (+0000) Subject: * (bug 4594) date("W", ..) is zero padded in PHP5, not so in PHP4, removing X-Git-Tag: 1.6.0~572 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=28e00611a7cb0f950bebe158a7c2a9d31736c4ac;p=lhc%2Fweb%2Fwiklou.git * (bug 4594) date("W", ..) is zero padded in PHP5, not so in PHP4, removing the padding --- 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