mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16454: Unhandled INF in date_sunset() with tiny $utcOffset
This commit is contained in:
commit
a920afd2d2
2 changed files with 32 additions and 0 deletions
|
@ -5516,6 +5516,9 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, bool calc_s
|
||||||
if (N > 24 || N < 0) {
|
if (N > 24 || N < 0) {
|
||||||
N -= floor(N / 24) * 24;
|
N -= floor(N / 24) * 24;
|
||||||
}
|
}
|
||||||
|
if (N > 24 || N < 0) {
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
switch (retformat) {
|
switch (retformat) {
|
||||||
case SUNFUNCS_RET_STRING:
|
case SUNFUNCS_RET_STRING:
|
||||||
|
|
29
ext/date/tests/gh16454.phpt
Normal file
29
ext/date/tests/gh16454.phpt
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
--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: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
|
||||||
|
|
||||||
|
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
|
||||||
|
bool(false)
|
Loading…
Add table
Add a link
Reference in a new issue