1--TEST--
2Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument.
3--SKIPIF--
4<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
5--FILE--
6<?php
7/* Prototype  : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
8 * Description: Returns time of sunset for a given day and location
9 * Source code: ext/date/php_date.c
10 * Alias to functions:
11 */
12
13echo "*** Testing date_sunset() : usage variation ***\n";
14
15// GMT is zero for the timezone
16date_default_timezone_set("Asia/Calcutta");
17//Initialise the variables
18$latitude = 38.4;
19$longitude = -9;
20$zenith = 90;
21$gmt_offset = 1;
22
23echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n";
24$time = 12.3456789000e10;
25var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
26var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
27var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
28
29echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n";
30$time = -12.3456789000e10;
31var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
32var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
33var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
34
35?>
36===DONE===
37--EXPECTF--
38*** Testing date_sunset() : usage variation ***
39
40-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --
41
42Warning: date_sunset() expects parameter 1 to be integer, float given in %s on line %d
43bool(false)
44
45Warning: date_sunset() expects parameter 1 to be integer, float given in %s on line %d
46bool(false)
47
48Warning: date_sunset() expects parameter 1 to be integer, float given in %s on line %d
49bool(false)
50
51-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --
52
53Warning: date_sunset() expects parameter 1 to be integer, float given in %s on line %d
54bool(false)
55
56Warning: date_sunset() expects parameter 1 to be integer, float given in %s on line %d
57bool(false)
58
59Warning: date_sunset() expects parameter 1 to be integer, float given in %s on line %d
60bool(false)
61===DONE===
62