Skip to content

Commit 1d4e229

Browse files
committed
Fix incorrect initialization in date_sunrise()
1 parent 0e1e991 commit 1d4e229

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ext/date/php_date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4435,7 +4435,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
44354435
}
44364436

44374437
if (longitude_is_null) {
4438-
latitude = INI_FLT("date.default_longitude");
4438+
longitude = INI_FLT("date.default_longitude");
44394439
}
44404440

44414441
if (zenith_is_null) {

ext/date/tests/date_sunrise_and_sunset_basic.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ echo "Basic test for date_sunrise() and date_sunset()\n";
1717
echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
1818
echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
1919

20+
// Check that calling with just the first parameter works.
21+
var_dump(gettype(date_sunrise(time())));
22+
var_dump(gettype(date_sunset(time())));
23+
2024
?>
2125
--EXPECTF--
2226
Basic test for date_sunrise() and date_sunset()
2327
%s %s %d %d, sunrise time : %d:%d
2428
%s %s %d %d, sunset time : %d:%d
29+
string(6) "string"
30+
string(6) "string"

0 commit comments

Comments
 (0)