I was able to resolve http://bugs.php.net/bug.php?id=44780 by changing
the fallbackmap from hours to minutes.  The bug is apparently due to
an issue with non-integer offsets.  Also, this patch adds a couple
missing time zones (Caracas and Shanghai, although there are likely
other missing time zones!), and uses the new spelling for Calcutta
(Kolkata).

--mark
Index: ext/date/lib/fallbackmap.h
===================================================================
RCS file: /repository/php-src/ext/date/lib/fallbackmap.h,v
retrieving revision 1.3
diff -u -p -r1.3 fallbackmap.h
--- ext/date/lib/fallbackmap.h	15 Oct 2005 18:14:40 -0000	1.3
+++ ext/date/lib/fallbackmap.h	8 May 2009 18:18:32 -0000
@@ -1,40 +1,42 @@
-	{ "sst",   0,  -11,  "Pacific/Apia" },
-	{ "hst",   0,  -10,  "Pacific/Honolulu" },
-	{ "akst",  0,   -9,  "America/Anchorage" },
-	{ "akdt",  1,   -8,  "America/Anchorage" },
-	{ "pst",   0,   -8,  "America/Los_Angeles" },
-	{ "pdt",   1,   -7,  "America/Los_Angeles" },
-	{ "mst",   0,   -7,  "America/Denver" },
-	{ "mdt",   1,   -6,  "America/Denver" },
-	{ "cst",   0,   -6,  "America/Chicago" },
-	{ "cdt",   1,   -5,  "America/Chicago" },
-	{ "est",   0,   -5,  "America/New_York" },
-	{ "edt",   1,   -4,  "America/New_York" },
-	{ "ast",   0,   -4,  "America/Halifax" },
-	{ "adt",   1,   -3,  "America/Halifax" },
-	{ "brt",   0,   -3,  "America/Sao_Paulo" },
-	{ "brst",  1,   -2,  "America/Sao_Paulo" },
-	{ "azost", 0,   -1,  "Atlantic/Azores" },
-	{ "azodt", 1,    0,  "Atlantic/Azores" },
-	{ "gmt",   0,    0,  "Europe/London" },
-	{ "bst",   1,    1,  "Europe/London" },
-	{ "cet",   0,    1,  "Europe/Paris" },
-	{ "cest",  1,    2,  "Europe/Paris" },
-	{ "eet",   0,    2,  "Europe/Helsinki" },
-	{ "eest",  1,    3,  "Europe/Helsinki" },
-	{ "msk",   0,    3,  "Europe/Moscow" },
-	{ "msd",   1,    4,  "Europe/Moscow" },
-	{ "gst",   0,    4,  "Asia/Dubai" },
-	{ "pkt",   0,    5,  "Asia/Karachi" },
-	{ "ist",   0,  5.5,  "Asia/Calcutta" },
-	{ "npt",   0, 5.75,  "Asia/Katmandu" },
-	{ "yekt",  1,    6,  "Asia/Yekaterinburg" },
-	{ "novst", 1,    7,  "Asia/Novosibirsk" },
-	{ "krat",  0,    7,  "Asia/Krasnoyarsk" },
-	{ "krast", 1,    8,  "Asia/Krasnoyarsk" },
-	{ "jst",   0,    9,  "Asia/Tokyo" },
-	{ "est",   0,   10,  "Australia/Melbourne" },
-	{ "cst",   1, 10.5,  "Australia/Adelaide" },
-	{ "est",   1,   11,  "Australia/Melbourne" },
-	{ "nzst",  0,   12,  "Pacific/Auckland" },
-	{ "nzdt",  1,   13,  "Pacific/Auckland" },
+	{ "sst",   0, -660, "Pacific/Apia" },
+	{ "hst",   0, -600, "Pacific/Honolulu" },
+	{ "akst",  0, -540, "America/Anchorage" },
+	{ "akdt",  1, -480, "America/Anchorage" },
+	{ "pst",   0, -480, "America/Los_Angeles" },
+	{ "pdt",   1, -420, "America/Los_Angeles" },
+	{ "mst",   0, -420, "America/Denver" },
+	{ "mdt",   1, -360, "America/Denver" },
+	{ "cst",   0, -360, "America/Chicago" },
+	{ "cdt",   1, -300, "America/Chicago" },
+	{ "est",   0, -300, "America/New_York" },
+	{ "vet",   0, -270, "America/Caracas" },
+	{ "edt",   1, -240, "America/New_York" },
+	{ "ast",   0, -240, "America/Halifax" },
+	{ "adt",   1, -180, "America/Halifax" },
+	{ "brt",   0, -180, "America/Sao_Paulo" },
+	{ "brst",  1, -120, "America/Sao_Paulo" },
+	{ "azost", 0,  -60, "Atlantic/Azores" },
+	{ "azodt", 1,    0, "Atlantic/Azores" },
+	{ "gmt",   0,    0, "Europe/London" },
+	{ "bst",   1,   60, "Europe/London" },
+	{ "cet",   0,   60, "Europe/Paris" },
+	{ "cest",  1,  120, "Europe/Paris" },
+	{ "eet",   0,  120, "Europe/Helsinki" },
+	{ "eest",  1,  180, "Europe/Helsinki" },
+	{ "msk",   0,  180, "Europe/Moscow" },
+	{ "msd",   1,  240, "Europe/Moscow" },
+	{ "gst",   0,  240, "Asia/Dubai" },
+	{ "pkt",   0,  300, "Asia/Karachi" },
+	{ "ist",   0,  330, "Asia/Kolkata" },
+	{ "npt",   0,  345, "Asia/Katmandu" },
+	{ "yekt",  1,  360, "Asia/Yekaterinburg" },
+	{ "novst", 1,  420, "Asia/Novosibirsk" },
+	{ "krat",  0,  420, "Asia/Krasnoyarsk" },
+	{ "cst",   0,  480, "Asia/Shanghai" },
+	{ "krast", 1,  480, "Asia/Krasnoyarsk" },
+	{ "jst",   0,  540, "Asia/Tokyo" },
+	{ "est",   0,  600, "Australia/Melbourne" },
+	{ "cst",   1,  630, "Australia/Adelaide" },
+	{ "est",   1,  660, "Australia/Melbourne" },
+	{ "nzst",  0,  720, "Pacific/Auckland" },
+	{ "nzdt",  1,  780, "Pacific/Auckland" },
Index: ext/date/lib/parse_date.c
===================================================================
RCS file: /repository/php-src/ext/date/lib/parse_date.c,v
retrieving revision 1.102
diff -u -p -r1.102 parse_date.c
--- ext/date/lib/parse_date.c	10 Mar 2009 23:39:11 -0000	1.102
+++ ext/date/lib/parse_date.c	8 May 2009 18:18:32 -0000
@@ -719,7 +719,7 @@ const static timelib_tz_lookup_table* zo
 	/* Still didn't find anything, let's find the zone solely based on
 	 * offset/isdst then */
 	for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
-		if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
+		if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
 			return fmp;
 		}
 	}
Index: ext/date/lib/parse_date.re
===================================================================
RCS file: /repository/php-src/ext/date/lib/parse_date.re,v
retrieving revision 1.92
diff -u -p -r1.92 parse_date.re
--- ext/date/lib/parse_date.re	18 Dec 2008 14:54:51 -0000	1.92
+++ ext/date/lib/parse_date.re	8 May 2009 18:18:32 -0000
@@ -717,7 +717,7 @@ const static timelib_tz_lookup_table* zo
 	/* Still didn't find anything, let's find the zone solely based on
 	 * offset/isdst then */
 	for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
-		if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
+		if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
 			return fmp;
 		}
 	}
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to