Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -5328,7 +5328,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);
Expand Down
18 changes: 18 additions & 0 deletions ext/date/tests/sunfuncts_partial_hour_utc_offset.phpt
Original file line number Diff line number Diff line change
@@ -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
Loading