mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
This commit is contained in:
@@ -5645,7 +5645,7 @@ PHP_FUNCTION(date_sun_info)
|
|||||||
array_init(return_value);
|
array_init(return_value);
|
||||||
|
|
||||||
/* Get sun up/down and transit */
|
/* 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) {
|
switch (rs) {
|
||||||
case -1: /* always below */
|
case -1: /* always below */
|
||||||
add_assoc_bool(return_value, "sunrise", 0);
|
add_assoc_bool(return_value, "sunrise", 0);
|
||||||
|
|||||||
12
ext/date/tests/bug-gh18076.phpt
Normal file
12
ext/date/tests/bug-gh18076.phpt
Normal 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
|
||||||
@@ -10,9 +10,9 @@ echo "Done\n";
|
|||||||
--EXPECT--
|
--EXPECT--
|
||||||
array(9) {
|
array(9) {
|
||||||
["sunrise"]=>
|
["sunrise"]=>
|
||||||
int(1165897682)
|
int(1165897761)
|
||||||
["sunset"]=>
|
["sunset"]=>
|
||||||
int(1165934239)
|
int(1165934160)
|
||||||
["transit"]=>
|
["transit"]=>
|
||||||
int(1165915961)
|
int(1165915961)
|
||||||
["civil_twilight_begin"]=>
|
["civil_twilight_begin"]=>
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ foreach ($sun_info as $key => $elem )
|
|||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
2007-04-13 06:11:26 CEST sunrise
|
2007-04-13 06:13:31 CEST sunrise
|
||||||
2007-04-13 20:32:56 CEST sunset
|
2007-04-13 20:30:51 CEST sunset
|
||||||
2007-04-13 13:22:11 CEST transit
|
2007-04-13 13:22:11 CEST transit
|
||||||
2007-04-13 05:29:22 CEST civil_twilight_begin
|
2007-04-13 05:29:22 CEST civil_twilight_begin
|
||||||
2007-04-13 21:15:00 CEST civil_twilight_end
|
2007-04-13 21:15:00 CEST civil_twilight_end
|
||||||
|
|||||||
Reference in New Issue
Block a user