Skip to content

Commit

Permalink
fix: work around PHP 5.5 issue with DateTimeZone offsets
Browse files Browse the repository at this point in the history
See: https://stackoverflow.com/a/14069062/964125

There are some legacy 5.5 deploys we don't want to break yet
  • Loading branch information
themightychris committed Mar 22, 2022
1 parent 2b54906 commit bcf199b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion php-classes/ActiveRecord.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,9 @@ protected function _setFieldValue($field, $value)
$offsetTimezone = static::getDatabaseOffsetTimezone();

if ($offsetTimezone) {
$offsetTimezone = new DateTimeZone($offsetTimezone);
// $offsetTimezone = new DateTimeZone($offsetTimezone);
// work around PHP 5.5 bug (fixed in 5.6): https://stackoverflow.com/a/14069062/964125
$offsetTimezone = DateTime::createFromFormat('O', $offsetTimezone)->getTimezone();
}
}

Expand Down

0 comments on commit bcf199b

Please sign in to comment.