]> granicus.if.org Git - php/commitdiff
- be sure that we got tzid by adding a default case
authorPierre Joye <pajoye@php.net>
Thu, 20 Jan 2011 07:05:34 +0000 (07:05 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 20 Jan 2011 07:05:34 +0000 (07:05 +0000)
ext/date/php_date.c

index b6a27d5dd173f9a46af07db5f11c56ea68777acd..75d2de186b9e2a3987f5c17b16ec2c9c82638bc7 100644 (file)
@@ -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;
        }