summaryrefslogtreecommitdiff
path: root/ext/calendar
diff options
context:
space:
mode:
authorChristoph M. Becker <cmb@php.net>2016-07-28 19:24:18 +0200
committerChristoph M. Becker <cmb@php.net>2016-07-28 19:25:22 +0200
commit28ade0e102b52159800c2f58b6081e0eb16df8b5 (patch)
treebe9e7c0eab7911a9d95275afa24daee5f05bca57 /ext/calendar
parent1315a3dd620926ba1f57eccb3081ab7c64d7a31f (diff)
parent7c412688f47005c8c6c375a2d5aae3863ceeebf8 (diff)
downloadphp-git-28ade0e102b52159800c2f58b6081e0eb16df8b5.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
Diffstat (limited to 'ext/calendar')
-rw-r--r--ext/calendar/calendar.c4
-rw-r--r--ext/calendar/tests/bug67976.phpt12
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 5dd226e473..1e4ad3dfde 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -359,6 +359,10 @@ PHP_FUNCTION(cal_days_in_month)
}
else {
sdn_next = calendar->to_jd(year + 1, 1, 1);
+ if (cal == CAL_FRENCH && sdn_next == 0) {
+ /* The French calendar ends on 0014-13-05. */
+ sdn_next = 2380953;
+ }
}
}
diff --git a/ext/calendar/tests/bug67976.phpt b/ext/calendar/tests/bug67976.phpt
new file mode 100644
index 0000000000..74e0bc81b1
--- /dev/null
+++ b/ext/calendar/tests/bug67976.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #67976 (cal_days_month() fails for final month of the French calendar)
+--SKIPIF--
+<?php
+if (!extension_loaded('calendar')) die('skip ext/calendar required');
+?>
+--FILE--
+<?php
+var_dump(cal_days_in_month(CAL_FRENCH, 13, 14));
+?>
+--EXPECT--
+int(5)