We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1feb210 + 0ee170b commit a7edde7Copy full SHA for a7edde7
ext/calendar/dow.c
@@ -33,14 +33,7 @@
33
int DayOfWeek(
34
zend_long sdn)
35
{
36
- int dow;
37
-
38
- dow = (sdn + 1) % 7;
39
- if (dow >= 0) {
40
- return (dow);
41
- } else {
42
- return (dow + 7);
43
- }
+ return (int)(sdn % 7 + 8) % 7;
44
}
45
46
const char * const DayNameShort[7] =
ext/calendar/tests/gh16258.phpt
@@ -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