From 30efc9f68e39a8d572ecc1918f87b0ddee80a141 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Sat, 18 Jun 2005 11:15:29 +0000 Subject: [PATCH] - Fixed a problem where the timestamp we are looking up a TZ info structure for was in the last record in the tz database. - Fixed problem in test case. --- ext/date/lib/parse_tz.c | 2 +- ext/date/tests/bug27780.phpt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c index 4591c8f10f..e88f3b2fe5 100644 --- a/ext/date/lib/parse_tz.c +++ b/ext/date/lib/parse_tz.c @@ -233,7 +233,7 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts) return &(tz->type[tz->trans_idx[i - 1]]); } } - return NULL; + return &(tz->type[tz->trans_idx[tz->timecnt - 1]]); } static tlinfo* fetch_leaptime_offset(timelib_tzinfo *tz, timelib_sll ts) diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt index 1c10340d47..f1e6eb67bd 100644 --- a/ext/date/tests/bug27780.phpt +++ b/ext/date/tests/bug27780.phpt @@ -99,8 +99,8 @@ Asia/Singapore America/Sao_Paulo 1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] -1076810400 [2004-02-14 23:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] -1076810401 [2004-02-14 23:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] +1076814000 [2004-02-15 00:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] +1076814001 [2004-02-15 00:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] 1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days] 1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago] 1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours] -- 2.40.0