Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -5140,6 +5140,9 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, bool calc_s
if (N > 24 || N < 0) {
N -= floor(N / 24) * 24;
}
if (N > 24 || N < 0) {
RETURN_FALSE;
}

switch (retformat) {
case SUNFUNCS_RET_STRING:
Expand Down
21 changes: 21 additions & 0 deletions ext/date/tests/gh16454.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
GH-16454 (Unhandled INF in date_sunset() with tiny $utcOffset)
--FILE--
<?php
var_dump(date_sunrise(0, SUNFUNCS_RET_STRING, 61, -150, 90, PHP_FLOAT_MAX));
var_dump(date_sunrise(0, SUNFUNCS_RET_STRING, 61, -150, 90, -PHP_FLOAT_MAX));
var_dump(date_sunset(0, SUNFUNCS_RET_STRING, 61, -150, 90, PHP_FLOAT_MAX));
var_dump(date_sunset(0, SUNFUNCS_RET_STRING, 61, -150, 90, -PHP_FLOAT_MAX));
?>
--EXPECTF--
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)
Loading