[php-src] Issue #20966: UBSan: date_sun_info() triggers undefined behavior with PHP_INT_MAX arguments (NaN to long long cast)
[email protected] (arshidkv12)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20966
Author: arshidkv12
### Description
The following code:
```php
<?php
var_dump(date_sun_info( 140, PHP_INT_MAX ,PHP_INT_MAX));
```
Resulted in this output:
```
var_dump(date_sun_info( 140, PHP_INT_MAX ,PHP_INT_MAX));
```
But I expected this output instead:
```
array(9) {
'sunrise' =>
int(0)
'sunset' =>
int(0)
'transit' =>
int(0)
'civil_twilight_begin' =>
int(0)
'civil_twilight_end' =>
int(0)
'nautical_twilight_begin' =>
int(0)
'nautical_twilight_end' =>
int(0)
'astronomical_twilight_begin' =>
int(0)
'astronomical_twilight_end' =>
int(0)
}
```
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Jan 18 2026 17:43:31) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
```
### Operating System
_No response_