xref: /php-src/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: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
35
36Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
37bool(false)
38
39Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
40
41Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
42bool(false)
43