]> granicus.if.org Git - php/commitdiff
Fix incorrect initialization in date_sunrise()
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 13:29:44 +0000 (15:29 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 13:33:01 +0000 (15:33 +0200)
ext/date/php_date.c
ext/date/tests/date_sunrise_and_sunset_basic.phpt

index e59e121dfb60ff01de01ab264dfb5afb0359bf28..46d50e283718fc441c97057684799ad36d760d2c 100644 (file)
@@ -4435,7 +4435,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
        }
 
        if (longitude_is_null) {
-               latitude = INI_FLT("date.default_longitude");
+               longitude = INI_FLT("date.default_longitude");
        }
 
        if (zenith_is_null) {
index b707c3ccb3d31039fa96cc667b4700d7848c97b4..c1606578eedb165e059c50f1c2425529fa770e75 100644 (file)
@@ -17,8 +17,14 @@ echo "Basic test for date_sunrise() and date_sunset()\n";
 echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
 echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
 
+// Check that calling with just the first parameter works.
+var_dump(gettype(date_sunrise(time())));
+var_dump(gettype(date_sunset(time())));
+
 ?>
 --EXPECTF--
 Basic test for date_sunrise() and date_sunset()
 %s %s %d %d, sunrise time : %d:%d
 %s %s %d %d, sunset time : %d:%d
+string(6) "string"
+string(6) "string"