Skip to content

Commit

Permalink
Fixed bug #74671 (DST timezone abbreviation has incorrect offset)
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed May 27, 2022
1 parent b902017 commit 6418eba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -3427,6 +3427,7 @@ static int timezone_initialize(php_timezone_obj *tzobj, const char *tz, size_t t
}

dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, &not_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
dummy_t->dst = dst;
if (not_found) {
php_error_docref(NULL, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
efree(dummy_t);
Expand Down
21 changes: 21 additions & 0 deletions ext/date/tests/bug74671.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Bug #74671 (DST timezone abbreviation has incorrect offset)
--FILE--
<?php
$dt = new DateTime(
'2017-05-16T10:11:32',
new DateTimeZone('CEST')
);
var_dump($dt);
var_dump($dt->format('c'));
?>
--EXPECTF--
object(DateTime)#%d (%d) {
["date"]=>
string(26) "2017-05-16 10:11:32.000000"
["timezone_type"]=>
int(2)
["timezone"]=>
string(4) "CEST"
}
string(25) "2017-05-16T10:11:32+02:00"

0 comments on commit 6418eba

Please sign in to comment.