Merge branch 'PHP-8.3' into PHP-8.4

This commit is contained in:
Derick Rethans 2025-04-22 17:11:15 +01:00
commit d54aee5b0c
No known key found for this signature in database
GPG key ID: 910DEB46F53EA312
4 changed files with 17 additions and 5 deletions

View file

@ -5645,7 +5645,7 @@ PHP_FUNCTION(date_sun_info)
array_init(return_value);
/* Get sun up/down and transit */
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
switch (rs) {
case -1: /* always below */
add_assoc_bool(return_value, "sunrise", 0);

View file

@ -0,0 +1,12 @@
--TEST--
GH-18076 (Since PHP 8, date_sun_info() returns inaccurate sunrise and sunset times)
--FILE--
<?php
date_default_timezone_set("UTC");
$sun_info = date_sun_info(strtotime("2025-03-21"), 51.48, 0.0);
echo date("H:i:s\n", $sun_info['sunrise']);
echo date("H:i:s\n", $sun_info['sunset']);
?>
--EXPECT--
05:59:21
18:14:48

View file

@ -10,9 +10,9 @@ echo "Done\n";
--EXPECT--
array(9) {
["sunrise"]=>
int(1165897682)
int(1165897761)
["sunset"]=>
int(1165934239)
int(1165934160)
["transit"]=>
int(1165915961)
["civil_twilight_begin"]=>

View file

@ -11,8 +11,8 @@ foreach ($sun_info as $key => $elem )
echo "Done\n";
?>
--EXPECT--
2007-04-13 06:11:26 CEST sunrise
2007-04-13 20:32:56 CEST sunset
2007-04-13 06:13:31 CEST sunrise
2007-04-13 20:30:51 CEST sunset
2007-04-13 13:22:11 CEST transit
2007-04-13 05:29:22 CEST civil_twilight_begin
2007-04-13 21:15:00 CEST civil_twilight_end