Skip to content

Commit 81acd54

Browse files
committed
changes from feedback
1 parent b2cea91 commit 81acd54

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ext/calendar/easter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, bool gm)
2828
struct tm te;
2929
zend_long year, golden, solar, lunar, pfm, dom, tmp, easter, result;
3030
zend_long method = CAL_EASTER_DEFAULT;
31+
const zend_long max_year = ZEND_LONG_MAX / 1.25;
3132
bool year_is_null = 1;
3233

3334
if (zend_parse_parameters(ZEND_NUM_ARGS(),
@@ -48,8 +49,8 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, bool gm)
4849
}
4950
}
5051

51-
if (year < 0 || year > (ZEND_LONG_MAX - 1)) {
52-
zend_argument_value_error(1, "must be between 0 and " ZEND_LONG_FMT, (ZEND_LONG_MAX - 1));
52+
if (year <= 0 || year > max_year) {
53+
zend_argument_value_error(1, "must be between 1 and " ZEND_LONG_FMT, max_year);
5354
RETURN_THROWS();
5455
}
5556

ext/calendar/tests/gh16228.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ try {
2121
}
2222
?>
2323
--EXPECTF--
24-
easter_days(): Argument #1 ($year) must be between 0 and %d
25-
easter_days(): Argument #1 ($year) must be between 0 and %d
26-
easter_date(): Argument #1 ($year) must be between 0 and %d
24+
easter_days(): Argument #1 ($year) must be between 1 and %d
25+
easter_days(): Argument #1 ($year) must be between 1 and %d
26+
easter_date(): Argument #1 ($year) must be between 1 and %d

0 commit comments

Comments
 (0)