xref: /PHP-8.2/ext/date/tests/gh14732.phpt (revision f9453a88)
1--TEST--
2GH-14732 (date_sun_info() fails for non-finite values)
3--FILE--
4<?php
5try {
6    date_sun_info(1, NAN, 1);
7} catch (ValueError $ex) {
8    echo $ex->getMessage(), "\n";
9}
10try {
11    date_sun_info(1, -INF, 1);
12} catch (ValueError $ex) {
13    echo $ex->getMessage(), "\n";
14}
15try {
16    date_sun_info(1, 1, NAN);
17} catch (ValueError $ex) {
18    echo $ex->getMessage(), "\n";
19}
20try {
21    date_sun_info(1, 1, INF);
22} catch (ValueError $ex) {
23    echo $ex->getMessage(), "\n";
24}
25var_dump(date_sunset(1, SUNFUNCS_RET_STRING, NAN, 1));
26var_dump(date_sunrise(1, SUNFUNCS_RET_STRING, 1, NAN));
27?>
28--EXPECTF--
29date_sun_info(): Argument #2 ($latitude) must be finite
30date_sun_info(): Argument #2 ($latitude) must be finite
31date_sun_info(): Argument #3 ($longitude) must be finite
32date_sun_info(): Argument #3 ($longitude) must be finite
33
34Deprecated: Function date_sunset() is deprecated in %s on line %d
35bool(false)
36
37Deprecated: Function date_sunrise() is deprecated in %s on line %d
38bool(false)
39