File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,11 @@ int DayOfWeek(
35
35
{
36
36
int dow ;
37
37
38
- if ((sdn + 1 ) > INT_MAX ) {
39
- return (0 );
40
- }
41
-
42
- dow = (sdn + 1 ) % 7 ;
38
+ dow = (int )(sdn % 7 + 1 );
43
39
if (dow >= 0 ) {
44
- return (dow );
40
+ return (dow % 7 );
45
41
} else {
46
- return (dow + 7 );
42
+ return (dow + 7 ) % 7 ;
47
43
}
48
44
}
49
45
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ array(9) {
25
25
["year"]=>
26
26
int(0)
27
27
["dow"]=>
28
- int(0 )
28
+ int(3 )
29
29
["abbrevdayname"]=>
30
30
string(3) "Wed"
31
31
["dayname"]=>
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ GH-16258 (jddayofweek overflow on argument)
4
4
calendar
5
5
--FILE--
6
6
<?php
7
- jddayofweek (9223372036854775807 , 1 );
8
- jddayofweek (- 9223372036854775806 , 1 );
7
+ jddayofweek (PHP_INT_MAX , 1 );
8
+ jddayofweek (PHP_INT_MIN , 1 );
9
9
echo "DONE " ;
10
10
?>
11
11
--EXPECT--
You can’t perform that action at this time.
0 commit comments