Last modified: 2006-09-09 23:09:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 7272 - Wrong server time and timestamp in Parser.php and SpecialPreferences.php
Wrong server time and timestamp in Parser.php and SpecialPreferences.php
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
All All
: Normal trivial with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-09-09 00:18 UTC by Guido
Modified: 2006-09-09 23:09 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Guido 2006-09-09 00:18:35 UTC

{{CURRENTTIME}} and {{CURRENTTIMESTAMP}} shows the wrong server time. The
problem is in the file 'includes/Parser.php'. This variables are filled by the
function 'wfTimestamp()' with 'gmmkdate()' which returns a date of GMT, but my
server is in germany (GMT +02:00). All other variables e.g. CURRENTDAY are
filled by normal date function which return the correct server time.

local server time: 09/09/2006 0:30
{{CURRENTTIME}} = 22:30 - wrong
{{CURRENTDAY}} = 9 - right
{{CURRENTMONTH}} = 09 - right

Fix in the Parser.php
- return $varCache[$index] = $wgContLang->time( wfTimestamp( TS_MW, $ts ),
false, false );
+ return $varCache[$index] = $wgContLang->time( date( 'YmdHis', $ts ), false,
false );

- return $varCache[$index] = wfTimestampNow();
+ return $varCache[$index] = date( 'YmdHis', $ts );

The same problem is on the user preferences.
Fix in the SpecialPreferences.php
- $nowserver = $wgLang->time( $now, false );
+ $nowserver = $wgLang->time( date( 'YmdHis', time() ), false );
Comment 1 Rotem Liss 2006-09-09 07:56:44 UTC
It may be a duplicate of Bug 366, but I don't think so, as all the other
{{CURRENTx}} variables use the server time, not GMT ({{LOCALx}} even use
$wgLocaltimezone, and never use GMT).

About the preferences, it's not a bug: $nowserver should be GMT in the
preferences page.
Comment 2 Guido 2006-09-09 23:09:07 UTC
Ok, you can set the bug invalid, but there is still a bug. Today I took the last
trunk version 1.8alpha to verify if the bug is fixed. If I understand it
correctly, then {{CURRENT*}} should indicate the UTC and {{LOCAL*}} the local
server time.

The bug is correct fixed only if you set $wgLocaltimezone.

Otherwise e.g. you receives this: 

{{CURRENTTIMESTAMP}} 20060909220135 - correct
{{LOCALTIMESTAMP}} 20060910000135 - correct
{{CURRENTDAY}} 10 - incorrect 
{{LOCALDAY}} 10 - correct
{{CURRENTDOW}} 0 - incorrect 
{{LOCALDOW}} 0 - correct
{{CURRENTHOUR}} 00 - incorrect
{{LOCALHOUR}} 00 - correct
{{CURRENTTIME}} 22:01 - correct
{{LOCALTIME}} 00:01 - correct

About the preferences: ok, it's not a bug it's a inexactly german translation.

Note You need to log in before you can comment on or make changes to this bug.