From: Derick Rethans Date: Mon, 31 Mar 2008 09:10:54 +0000 (+0000) Subject: - Fixed a bug in formatting timestamps when DST is active in the default X-Git-Tag: RELEASE_2_0_0b1~527 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08534e1beea2797a3d50e8869789522bab21c3a5;p=php - Fixed a bug in formatting timestamps when DST is active in the default timezone. --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index ee571c74cc..0bd27f8dff 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -868,9 +868,9 @@ static char *date_format(char *format, int format_len, int *return_len, timelib_ offset->abbr = strdup(t->tz_abbr); } else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) { offset = timelib_time_offset_ctor(); - offset->offset = (t->z - (t->dst * 60)) * -60; + offset->offset = (t->z) * -60; offset->leap_secs = 0; - offset->is_dst = t->dst; + offset->is_dst = 0; offset->abbr = malloc(9); /* GMT±xxxx\0 */ snprintf(offset->abbr, 9, "GMT%c%02d%02d", localtime ? ((offset->offset < 0) ? '-' : '+') : '+', diff --git a/ext/date/tests/timestamp-in-dst.phpt b/ext/date/tests/timestamp-in-dst.phpt new file mode 100644 index 0000000000..232bd7fece --- /dev/null +++ b/ext/date/tests/timestamp-in-dst.phpt @@ -0,0 +1,13 @@ +--TEST-- +Format timestamp in DST test +--INI-- +date.timezone=CEST +--FILE-- +format( 'c' ) ); +?> +--EXPECT-- +string(25) "2008-02-14T13:34:51+00:00" +--UEXPECT-- +unicode(25) "2008-02-14T13:34:51+00:00"