Skip to content

Commit 6418eba

Browse files
committed
Fixed bug #74671 (DST timezone abbreviation has incorrect offset)
1 parent b902017 commit 6418eba

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ext/date/php_date.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3427,6 +3427,7 @@ static int timezone_initialize(php_timezone_obj *tzobj, const char *tz, size_t t
34273427
}
34283428

34293429
dummy_t->z = timelib_parse_zone(&tz, &dst, dummy_t, &not_found, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
3430+
dummy_t->dst = dst;
34303431
if (not_found) {
34313432
php_error_docref(NULL, E_WARNING, "Unknown or bad timezone (%s)", orig_tz);
34323433
efree(dummy_t);

ext/date/tests/bug74671.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #74671 (DST timezone abbreviation has incorrect offset)
3+
--FILE--
4+
<?php
5+
$dt = new DateTime(
6+
'2017-05-16T10:11:32',
7+
new DateTimeZone('CEST')
8+
);
9+
var_dump($dt);
10+
var_dump($dt->format('c'));
11+
?>
12+
--EXPECTF--
13+
object(DateTime)#%d (%d) {
14+
["date"]=>
15+
string(26) "2017-05-16 10:11:32.000000"
16+
["timezone_type"]=>
17+
int(2)
18+
["timezone"]=>
19+
string(4) "CEST"
20+
}
21+
string(25) "2017-05-16T10:11:32+02:00"

0 commit comments

Comments
 (0)