From 6418eba1cd376b82e94a905bf10212126337bcd2 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 20 May 2022 15:28:15 +0100 Subject: [PATCH] Fixed bug #74671 (DST timezone abbreviation has incorrect offset) --- ext/date/php_date.c | 1 + ext/date/tests/bug74671.phpt | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 ext/date/tests/bug74671.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index a79cd8c203f..a4f58b3ff31 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -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, ¬_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); diff --git a/ext/date/tests/bug74671.phpt b/ext/date/tests/bug74671.phpt new file mode 100644 index 00000000000..a553ffa3ff1 --- /dev/null +++ b/ext/date/tests/bug74671.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #74671 (DST timezone abbreviation has incorrect offset) +--FILE-- +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"