Skip to content

Commit e8b73c4

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
2 parents fde5e50 + a5e8ac6 commit e8b73c4

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PHP NEWS
66
. Fixed GH-16240: jdtounix overflow on argument value. (David Carlier)
77
. Fixed GH-16241: easter_days/easter_date overflow on year argument.
88
(David Carlier)
9+
. Fixed GH-16263: jddayofweek overflow. (cmb)
910

1011
- CLI:
1112
. Fixed bug GH-16137: duplicate http headers when set several times by

ext/calendar/dow.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@
3333
int DayOfWeek(
3434
zend_long sdn)
3535
{
36-
int dow;
37-
38-
dow = (sdn + 1) % 7;
39-
if (dow >= 0) {
40-
return (dow);
41-
} else {
42-
return (dow + 7);
43-
}
36+
return (int)(sdn % 7 + 8) % 7;
4437
}
4538

4639
const char * const DayNameShort[7] =

ext/calendar/tests/gh16258.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
GH-16258 (jddayofweek overflow on argument)
3+
--EXTENSIONS--
4+
calendar
5+
--FILE--
6+
<?php
7+
jddayofweek(PHP_INT_MAX, 1);
8+
jddayofweek(PHP_INT_MIN, 1);
9+
echo "DONE";
10+
?>
11+
--EXPECT--
12+
DONE

0 commit comments

Comments
 (0)