MDL_41126 phpunit: Timestamp should be less than 2038

http://php.net/manual/en/datetime.gettimestamp.php#114590
In 32-bit system the unix timestamp will overflow if the date goes beyond year 2038
and this method will return false.
This commit is contained in:
Rajesh Taneja
2016-08-09 10:50:07 +08:00
parent 763c5b0eb4
commit 9f2b916dee
3 changed files with 16 additions and 5 deletions
+5
View File
@@ -2053,6 +2053,11 @@ function make_timestamp($year, $month=1, $day=1, $hour=0, $minute=0, $second=0,
$time = $date->getTimestamp();
if ($time === false) {
throw new coding_exception('getTimestamp() returned false, please ensure you have passed correct values.'.
' This can fail if year is more than 2038 and OS is 32 bit windows');
}
// Moodle BC DST stuff.
if (!$applydst) {
$time += dst_offset_on($time, $timezone);