diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index dd0984c8b6e..e08a794497c 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue Jul 15 19:21:36 2008 */ +/* Generated by re2c 0.13.5 on Wed Jul 16 17:24:19 2008 */ #line 1 "ext/date/lib/parse_date.re" /* +----------------------------------------------------------------------+ @@ -800,7 +800,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_ } #endif /* If we have a TimeZone identifier to start with, use it */ - if (strstr(tz_abbr, "/")) { + if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) { if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) { t->tz_info = res; t->zone_type = TIMELIB_ZONETYPE_ID; diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 14bd7e88db4..2a66d51461c 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -798,7 +798,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_ } #endif /* If we have a TimeZone identifier to start with, use it */ - if (strstr(tz_abbr, "/")) { + if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) { if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) { t->tz_info = res; t->zone_type = TIMELIB_ZONETYPE_ID; diff --git a/ext/date/tests/bug45529.phpt b/ext/date/tests/bug45529.phpt new file mode 100644 index 00000000000..ce4bca96b37 --- /dev/null +++ b/ext/date/tests/bug45529.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #45529 (UTC not properly recognised as timezone identifier while parsing) +--FILE-- +getTimeZone(); +echo $tz1->getName(), PHP_EOL; +echo $tz2->getName(), PHP_EOL; +$d = new DateTime('2008-01-01 12:00:00+0200'); +$d->setTimeZone($tz1); +echo $d->format(DATE_ISO8601), PHP_EOL; +$d = new DateTime('2008-01-01 12:00:00+0200'); +$d->setTimeZone($tz2); +echo $d->format(DATE_ISO8601), PHP_EOL; +?> +--EXPECT-- +UTC +UTC +2008-01-01T10:00:00+0000 +2008-01-01T10:00:00+0000