[php-src] PR #16497: Fix GH-14732: date_sun_info() fails for non-finite values
| From: | cmb69 | Date: | Fri, 18 Oct 2024 16:04:42 +0000 |
| Subject: | [php-src] PR #16497: Fix GH-14732: date_sun_info() fails for non-finite values | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-29302@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/16497
Author: cmb69
timelib_astro_rise_set_altitude() is not prepared to deal with non- finite values
(nan, inf and -inf) for lon and
lat; instead these trigger undefined behavior. Thus we catch non-finite values before
even calling that timelib function; for date_sun_info() we trigger
ValueErrors; for date_sunrise() and date_sunset() we silently
return false, since these functions will be sunsetted anyway.
---
Note for merger:
<details><summary>Test expectations for PHP 8.4 and up</summary>
````
date_sun_info(): Argument #2 ($latitude) must be finite
date_sun_info(): Argument #2 ($latitude) must be finite
date_sun_info(): Argument #3 ($longitude) must be finite
date_sun_info(): Argument #3 ($longitude) must be finite
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_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on
line %d
bool(false)
````
</details>