k5n webcalendar timezone: Wrong GMT offset

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

k5n webcalendar timezone: Wrong GMT offset

Post by ^rooker »

[PROBLEM]
After upgrading from k5n's php webcalendar v1.2.0 to v1.2.3, the time values are incorrect. They're off by a static offset.

When checking my user's webcalender config under "settings > preferences", it always writes:
Your current GMT offset is -5 hours.
Regardless of what timezone I select.

[SOLUTION]
This seems to be related to a bug in v1.2.3. Thanks to an entry in the sourceforge forums, I was pointed into the direction of the error:

Workaround:
In 'webcalendar/includes/functions.php' on line 3815, there's the following code:

Code: Select all

date_default_timezone_set ( $GLOBALS['TIMEZONE'] );
Disabling it is a workaround (but I'd say no fix).

Fix?
A few lines above, there's the culprit:

Code: Select all

// Set SERVER TIMEZONE.
if ( empty ( $GLOBALS['TIMEZONE'] ) )
$GLOBALS['TIMEZONE'] = $GLOBALS['SERVER_TIMEZONE'];
$GLOBALS['TIMEZONE'] is not empty by default, but has the value:
America/New_York
...the question is: Where does that one come from?
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply