mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix date_sunrise() and date_sunset() with partial-hour UTC offset
This commit is contained in:
4
NEWS
4
NEWS
@@ -8,6 +8,10 @@ PHP NEWS
|
||||
. Fixed bug GH-19637 (Incorrect Closure scope for FCC in constant
|
||||
expression). (timwolla)
|
||||
|
||||
- Date:
|
||||
. Fixed date_sunrise() and date_sunset() with partial-hour UTC offset.
|
||||
(ilutov)
|
||||
|
||||
- EXIF:
|
||||
. Added support to retrieve Exif from HEIF file. (Benstone Zhang)
|
||||
|
||||
|
||||
@@ -5493,7 +5493,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, bool calc_s
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
|
||||
if (gmt_offset_is_null) {
|
||||
gmt_offset = timelib_get_current_offset(t) / 3600;
|
||||
gmt_offset = timelib_get_current_offset(t) / 3600.0;
|
||||
}
|
||||
|
||||
timelib_unixtime2local(t, time);
|
||||
|
||||
18
ext/date/tests/sunfuncts_partial_hour_utc_offset.phpt
Normal file
18
ext/date/tests/sunfuncts_partial_hour_utc_offset.phpt
Normal file
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Incorrect timezone detection in date_sunrise() for partial-hour UTC offsets
|
||||
--FILE--
|
||||
<?php
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$timestamp = mktime(0, 0, 0, 2, 9, 2025);
|
||||
$longitude = 22.57;
|
||||
$latitude = 88.36;
|
||||
|
||||
echo @date_sunrise($timestamp, SUNFUNCS_RET_STRING, $longitude, $latitude), "\n";
|
||||
|
||||
$dt = new DateTime();
|
||||
$dt->setTimestamp(date_sun_info($timestamp, $longitude, $latitude)['sunrise']);
|
||||
echo $dt->format('H:i'), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
06:10
|
||||
06:11
|
||||
Reference in New Issue
Block a user