From: Pierre Joye Date: Thu, 20 Jan 2011 07:05:34 +0000 (+0000) Subject: - be sure that we got tzid by adding a default case X-Git-Tag: php-5.4.0alpha1~191^2~334 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0af377bd8ecb24a7282910f6421423a6153c18e;p=php - be sure that we got tzid by adding a default case --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index b6a27d5dd1..75d2de186b 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -889,17 +889,6 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) switch (GetTimeZoneInformation(&tzi)) { - /* no DST or not in effect */ - case TIME_ZONE_ID_UNKNOWN: - case TIME_ZONE_ID_STANDARD: -php_win_std_time: - tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.StandardBias) * -60, 0); - if (! tzid) { - tzid = "UTC"; - } - php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0)); - break; - /* DST in effect */ case TIME_ZONE_ID_DAYLIGHT: /* If user has disabled DST in the control panel, Windows returns 0 here */ @@ -908,11 +897,24 @@ php_win_std_time: } tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.DaylightBias) * -60, 1); - if (! tzid) { + if (tzid == NULL) { tzid = "UTC"; } php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, ((tzi.Bias + tzi.DaylightBias) / -60.0)); break; + + /* no DST or not in effect */ + case TIME_ZONE_ID_UNKNOWN: + case TIME_ZONE_ID_STANDARD: + default: +php_win_std_time: + tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.StandardBias) * -60, 0); + if (! tzid) { + tzid = "UTC"; + } + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0)); + break; + } return tzid; }