pajoye                                   Thu, 20 Jan 2011 07:05:34 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307618

Log:
- be sure that we got tzid by adding a default case

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/date/php_date.c
    U   php/php-src/trunk/ext/date/php_date.c

Modified: php/php-src/branches/PHP_5_3/ext/date/php_date.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/php_date.c    2011-01-20 06:58:04 UTC 
(rev 307617)
+++ php/php-src/branches/PHP_5_3/ext/date/php_date.c    2011-01-20 07:05:34 UTC 
(rev 307618)
@@ -889,17 +889,6 @@

                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 @@
                                }

                                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;
        }

Modified: php/php-src/trunk/ext/date/php_date.c
===================================================================
--- php/php-src/trunk/ext/date/php_date.c       2011-01-20 06:58:04 UTC (rev 
307617)
+++ php/php-src/trunk/ext/date/php_date.c       2011-01-20 07:05:34 UTC (rev 
307618)
@@ -889,17 +889,6 @@

                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 @@
                                }

                                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;
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to