File tree 3 files changed +23
-2
lines changed
3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 20
20
21
21
- Fixed bug #52786 (PHP should reset section to [PHP] after ini sections).
22
22
(Fedora at famillecollet dot com)
23
+ - Fixed bug #52744 (cal_days_in_month incorrect for December 1 BCE).
24
+ (gpap at internet dot gr, Adam)
23
25
- Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they
24
26
were not available). (fat)
25
27
- Fixed bug #52745 (Binding params doesn't work when selecting a date inside a
Original file line number Diff line number Diff line change @@ -348,8 +348,15 @@ PHP_FUNCTION(cal_days_in_month)
348
348
sdn_next = calendar -> to_jd (year , 1 + month , 1 );
349
349
350
350
if (sdn_next == 0 ) {
351
- /* if invalid, try first month of the next year... */
352
- sdn_next = calendar -> to_jd (year + 1 , 1 , 1 );
351
+ /* If the next month is invalid, then we need to try the first month of
352
+ * the next year, bearing in mind that the next year after 1 BCE is
353
+ * actually 1 AD and not 0. */
354
+ if (year == -1 ) {
355
+ sdn_next = calendar -> to_jd (1 , 1 , 1 );
356
+ }
357
+ else {
358
+ sdn_next = calendar -> to_jd (year + 1 , 1 , 1 );
359
+ }
353
360
}
354
361
355
362
RETURN_LONG (sdn_next - sdn_start );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #52744 (cal_days_in_month incorrect for December 1 BCE)
3
+ --SKIPIF--
4
+ <?php include 'skipif.inc ' ; ?>
5
+ --FILE--
6
+ <?php
7
+ var_dump (cal_days_in_month (CAL_GREGORIAN , 12 , -1 ));
8
+ var_dump (cal_days_in_month (CAL_JULIAN , 12 , -1 ));
9
+ ?>
10
+ --EXPECT--
11
+ int(31)
12
+ int(31)
You can’t perform that action at this time.
0 commit comments