Skip to content

Fix/easter date windows upper bound - #23916

Open
marc-mabe wants to merge 2 commits into
php:PHP-8.4from
marc-mabe:fix/easter-date-windows-upper-bound
Open

marc-mabe wants to merge 2 commits into
php:PHP-8.4from
marc-mabe:fix/easter-date-windows-upper-bound

Conversation

@marc-mabe

Copy link
Copy Markdown
Contributor

fixed #23915

@marc-mabe
marc-mabe force-pushed the fix/easter-date-windows-upper-bound branch from 3b8ab94 to dcbdd5c Compare September 25, 2026 19:09

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, can you fix the nits? :)

Comment thread ext/calendar/tests/gh23915.phpt Outdated
Comment thread ext/calendar/tests/gh23915_windows.phpt Outdated
@marc-mabe
marc-mabe force-pushed the fix/easter-date-windows-upper-bound branch from dcbdd5c to db2fa13 Compare September 27, 2026 18:21
Comment thread ext/calendar/tests/gh23915.phpt Outdated
echo $year, ': ';
try {
echo date('Y-m-d', easter_date($year)), PHP_EOL;
} catch (ValueError $e) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (ValueError $e) {
} catch (Throwable $e) {

Comment thread ext/calendar/tests/gh23915_windows.phpt Outdated
echo $year, ': ';
try {
echo date('Y-m-d', easter_date($year)), "\n";
} catch (ValueError $e) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (ValueError $e) {
} catch (Throwable $e) {

Comment on lines +22 to +25
} catch (ValueError $ex) {
echo "{$ex->getMessage()}\n";
}
?>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (ValueError $ex) {
echo "{$ex->getMessage()}\n";
}
?>
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>

Depending on the year, easter_date() reported the range of easter_days()
or only one of its bounds. Determine the supported range once and report
it in a single error message.
mktime() on Windows only goes up to the year 3000 and returns -1 beyond
that, so easter_date() returned -1 instead of throwing for the years
3001 to 2000000000. Limit the year to 3000 on Windows.
@marc-mabe
marc-mabe force-pushed the fix/easter-date-windows-upper-bound branch from db2fa13 to 798cce7 Compare September 28, 2026 05:46
@marc-mabe

Copy link
Copy Markdown
Contributor Author

@Girgias Now, it should have been addressed correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants