Skip to content

Commit 735f7fa

Browse files
committed
rework checks and re-establish old test value.
1 parent 35325ca commit 735f7fa

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

ext/calendar/dow.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ int DayOfWeek(
3535
{
3636
int dow;
3737

38-
if ((sdn + 1) > INT_MAX) {
39-
return (0);
40-
}
41-
42-
dow = (sdn + 1) % 7;
38+
dow = (int)(sdn % 7 + 1);
4339
if (dow >= 0) {
44-
return (dow);
40+
return (dow % 7);
4541
} else {
46-
return (dow + 7);
42+
return (dow + 7) % 7;
4743
}
4844
}
4945

ext/calendar/tests/bug53574_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ array(9) {
2525
["year"]=>
2626
int(0)
2727
["dow"]=>
28-
int(0)
28+
int(3)
2929
["abbrevdayname"]=>
3030
string(3) "Wed"
3131
["dayname"]=>

0 commit comments

Comments
 (0)