diff --git a/NEWS b/NEWS index 9ae85310388..8e1225b936e 100644 --- a/NEWS +++ b/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) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index fd4dc05a7ea..e69512cedb4 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -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); diff --git a/ext/date/tests/sunfuncts_partial_hour_utc_offset.phpt b/ext/date/tests/sunfuncts_partial_hour_utc_offset.phpt new file mode 100644 index 00000000000..279e40fa654 --- /dev/null +++ b/ext/date/tests/sunfuncts_partial_hour_utc_offset.phpt @@ -0,0 +1,18 @@ +--TEST-- +Incorrect timezone detection in date_sunrise() for partial-hour UTC offsets +--FILE-- +setTimestamp(date_sun_info($timestamp, $longitude, $latitude)['sunrise']); +echo $dt->format('H:i'), "\n"; +?> +--EXPECT-- +06:10 +06:11