This is a patch to fix the main issue in bug #54254,
cal_from_jd(CAL_JEWISH) returns month=6 for Adar when there is only
one Adar, (it should return 7, since if there is only one Adar it's
AdarII). This will clear up an issue where cal_from_jd() returns a
month that cal_days_in_month() reports to have 0 days due to an
inconsistency in how dates are converted to and from the Jewish
calendar. This patch should create the correct behavior.

I hope this can be applied and put into place soon, as this bug causes
malfunctions that have to be worked around.

Thanks,
Eitan

https://bugs.php.net/bug.php?id=54254
Index: ext/calendar/tests/jdtojewish.phpt
===================================================================
--- ext/calendar/tests/jdtojewish.phpt	(revision 322030)
+++ ext/calendar/tests/jdtojewish.phpt	(working copy)
@@ -14,10 +14,11 @@
 	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 @@
 ב' חשון ה'תשס"ג
 ב' חשון ה אלפים תשס"ג
 ב' חשון ה' אלפים תשס"ג
+7/20/5767
 "
Index: ext/calendar/jewish.c
===================================================================
--- ext/calendar/jewish.c	(revision 322030)
+++ ext/calendar/jewish.c	(working copy)
@@ -587,11 +587,11 @@
 				(*pMonth)--;
 				(*pDay) += 30;
 			} else {
-				*pMonth = 6;
+				*pMonth = 7;
 				*pDay = inputDay - tishri1 + 207;
 				if (*pDay > 0)
 					return;
-				(*pMonth)--;
+				(*pMonth)-=2;
 				(*pDay) += 30;
 			}
 			if (*pDay > 0)
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to