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