-
Sub-task
-
Resolution: Fixed
-
Critical
-
1.9.12, 2.0
-
MOODLE_19_STABLE, MOODLE_20_STABLE
-
MOODLE_19_STABLE, MOODLE_20_STABLE
-
wip-mdl-27577-master
-
/lib/moodlelib.php functions userdate() and make_timestamp() were applying dst_offset for numeric timezones, i.e. 0 (UTC)
Our remedy:
function make_timestamp($year, $month=1, $day=1, $hour=0, $minute=0, $second=0, $timezone=99, $applydst=true) {
|
|
$passedtimezone = $timezone;
|
$strtimezone = NULL;
|
if (!is_numeric($timezone)) {
|
$strtimezone = $timezone;
|
}
|
|
$timezone = get_user_timezone_offset($timezone);
|
|
if (abs($timezone) > 13) {
|
$time = mktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
|
} else {
|
$time = gmmktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
|
$time = usertime($time, $timezone);
|
if ($applydst && ($passedtimezone == 99 || !is_numeric($passedtimezone))) {
|
$time -= dst_offset_on($time, $strtimezone);
|
}
|
}
|
|
return $time;
|
|
}
|
|
in userdate():
|
... // added if clause
|
if ($timezone == 99 || !is_numeric($timezone)) {
|
$date += dst_offset_on($date, $strtimezone);
|
}
|
...
|
- has a non-specific relationship to
-
MDL-27863 Fix testcase issues found in MDL-27577
- Closed