From 49ec2ab35941f076de8c327d7bc40e2eb344a7c8 Mon Sep 17 00:00:00 2001 From: Eitan Mosenkis Date: Thu, 12 Jul 2012 09:32:36 -0400 Subject: [PATCH 1/3] Fix bug 54254 --- ext/calendar/jewish.c | 4 ++-- ext/calendar/tests/jdmonthname.phpt | 4 ++-- ext/calendar/tests/jdtojewish.phpt | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index f4dc7c35ae57c..ee9ab4b8a60c2 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -587,11 +587,11 @@ void SdnToJewish( (*pMonth)--; (*pDay) += 30; } else { - *pMonth = 6; + *pMonth = 7; *pDay = inputDay - tishri1 + 207; if (*pDay > 0) return; - (*pMonth)--; + (*pMonth) -= 2; (*pDay) += 30; } if (*pDay > 0) diff --git a/ext/calendar/tests/jdmonthname.phpt b/ext/calendar/tests/jdmonthname.phpt index d05d3c595efca..0a3528cf17efe 100644 --- a/ext/calendar/tests/jdmonthname.phpt +++ b/ext/calendar/tests/jdmonthname.phpt @@ -178,7 +178,7 @@ Heshvan Kislev Tevet Shevat -AdarI +AdarII Nisan Iyyar Sivan @@ -279,7 +279,7 @@ Heshvan Kislev Tevet Shevat -AdarI +AdarII Nisan Iyyar Sivan diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt index 484b95749cca9..a88be45475a6e 100644 --- a/ext/calendar/tests/jdtojewish.phpt +++ b/ext/calendar/tests/jdtojewish.phpt @@ -14,10 +14,11 @@ var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n"); + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(3,10,2007))."\r\n"); ?> --EXPECT-- -string(184) "2/22/5763 +string(195) "2/22/5763 כב חשון התשסג כב חשון ה'תשסג כב חשון ה אלפים תשסג @@ -27,4 +28,5 @@ string(184) "2/22/5763 ב' חשון ה'תשס"ג ב' חשון ה אלפים תשס"ג ב' חשון ה' אלפים תשס"ג +7/20/5767 " From eb44db74286ff568f3a5656391dbbf99ec668d1d Mon Sep 17 00:00:00 2001 From: Eitan Mosenkis Date: Sun, 15 Jul 2012 20:36:34 -0400 Subject: [PATCH 2/3] Update documentation to reflect fix of 54254 --- ext/calendar/jewish.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index ee9ab4b8a60c2..8c2e9a1cdb347 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -85,8 +85,8 @@ * 3 Kislev 29 30 30 29 30 30 (variable) * 4 Tevet 29 29 29 29 29 29 * 5 Shevat 30 30 30 30 30 30 - * 6 Adar I 29 29 29 30 30 30 (variable) - * 7 Adar II -- -- -- 29 29 29 (optional) + * 6 Adar I -- -- -- 30 30 30 (optional) + * 7 Adar II 29 29 29 29 29 29 * 8 Nisan 30 30 30 30 30 30 * 9 Iyyar 29 29 29 29 29 29 * 10 Sivan 30 30 30 30 30 30 @@ -100,8 +100,8 @@ * have multiple possible spellings in the Roman character set. I have * chosen to use the spellings found in the Encyclopedia Judaica. * - * Adar II, the month added for leap years, is sometimes referred to as - * the 13th month, but I have chosen to assign it the number 7 to keep + * Adar I, the month added for leap years, is sometimes referred to as + * the 13th month, but I have chosen to assign it the number 6 to keep * the months in chronological order. This may not be consistent with * other numbering schemes. * From 288c467afd953ea539d9e3deeb384f80c014b67e Mon Sep 17 00:00:00 2001 From: Eitan Mosenkis Date: Thu, 19 Jul 2012 08:54:30 -0400 Subject: [PATCH 3/3] Add test for interoperability of jdtojewish and cal_days_in_month --- ext/calendar/tests/bug54254.phpt | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ext/calendar/tests/bug54254.phpt diff --git a/ext/calendar/tests/bug54254.phpt b/ext/calendar/tests/bug54254.phpt new file mode 100644 index 0000000000000..df9362320c0a6 --- /dev/null +++ b/ext/calendar/tests/bug54254.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug #54254 (cal_days_in_month incompatible with jdtojewish in non-leap-years) +--SKIPIF-- + +--FILE-- +