1--TEST--
2Test date_sun_info() function : error variations - Pass unexpected values for time argument
3--FILE--
4<?php
5/* Prototype  : array date_sun_info ( int $time , float $latitude , float $longitude )
6 * Description:  Returns an array with information about sunset/sunrise and twilight begin/end.
7 * Source code: ext/standard/data/php_date.c
8 */
9
10date_default_timezone_set("UTC");
11
12echo "*** Testing date_sun_info() : usage variations ***\n";
13
14//get an unset variable
15$unset_var = 10;
16unset ($unset_var);
17
18// heredoc string
19$heredoc = <<<EOT
20abc
21xyz
22EOT;
23
24// get a resource variable
25$fp = fopen(__FILE__, "r");
26
27$inputs = array(
28       // int data
29/*1*/  0,
30       1,
31       12345,
32       -2345,
33
34       // float data
35/*5*/  10.5,
36       -10.5,
37       12.3456789000e5,
38       12.3456789000E-5,
39       .5,
40
41       // null data
42/*10*/ NULL,
43       null,
44
45       // boolean data
46/*12*/ true,
47       false,
48       TRUE,
49       FALSE,
50
51       // empty data
52/*16*/ "",
53       '',
54       array(),
55
56       // string data
57/*19*/ "abcxyz",
58       'abcxyz',
59       $heredoc,
60
61       // undefined data
62/*22*/ @$undefined_var,
63
64       // unset data
65/*23*/ @$unset_var,
66
67       // resource variable
68/*24*/ $fp
69);
70
71// loop through each element of $inputs to check the behaviour of date_sun_info()
72$iterator = 1;
73foreach($inputs as $input) {
74    echo "\n-- Iteration $iterator --\n";
75    var_dump(date_sun_info($input,  31.7667, 35.2333));
76    $iterator++;
77};
78
79?>
80===Done===
81--EXPECTF--
82*** Testing date_sun_info() : usage variations ***
83
84-- Iteration 1 --
85array(9) {
86  ["sunrise"]=>
87  int(16748)
88  ["sunset"]=>
89  int(53182)
90  ["transit"]=>
91  int(34965)
92  ["civil_twilight_begin"]=>
93  int(15145)
94  ["civil_twilight_end"]=>
95  int(54786)
96  ["nautical_twilight_begin"]=>
97  int(13324)
98  ["nautical_twilight_end"]=>
99  int(56607)
100  ["astronomical_twilight_begin"]=>
101  int(11542)
102  ["astronomical_twilight_end"]=>
103  int(58389)
104}
105
106-- Iteration 2 --
107array(9) {
108  ["sunrise"]=>
109  int(16748)
110  ["sunset"]=>
111  int(53182)
112  ["transit"]=>
113  int(34965)
114  ["civil_twilight_begin"]=>
115  int(15145)
116  ["civil_twilight_end"]=>
117  int(54786)
118  ["nautical_twilight_begin"]=>
119  int(13324)
120  ["nautical_twilight_end"]=>
121  int(56607)
122  ["astronomical_twilight_begin"]=>
123  int(11542)
124  ["astronomical_twilight_end"]=>
125  int(58389)
126}
127
128-- Iteration 3 --
129array(9) {
130  ["sunrise"]=>
131  int(16748)
132  ["sunset"]=>
133  int(53182)
134  ["transit"]=>
135  int(34965)
136  ["civil_twilight_begin"]=>
137  int(15145)
138  ["civil_twilight_end"]=>
139  int(54786)
140  ["nautical_twilight_begin"]=>
141  int(13324)
142  ["nautical_twilight_end"]=>
143  int(56607)
144  ["astronomical_twilight_begin"]=>
145  int(11542)
146  ["astronomical_twilight_end"]=>
147  int(58389)
148}
149
150-- Iteration 4 --
151array(9) {
152  ["sunrise"]=>
153  int(-69665)
154  ["sunset"]=>
155  int(-33260)
156  ["transit"]=>
157  int(-51462)
158  ["civil_twilight_begin"]=>
159  int(-71269)
160  ["civil_twilight_end"]=>
161  int(-31655)
162  ["nautical_twilight_begin"]=>
163  int(-73092)
164  ["nautical_twilight_end"]=>
165  int(-29832)
166  ["astronomical_twilight_begin"]=>
167  int(-74874)
168  ["astronomical_twilight_end"]=>
169  int(-28050)
170}
171
172-- Iteration 5 --
173array(9) {
174  ["sunrise"]=>
175  int(16748)
176  ["sunset"]=>
177  int(53182)
178  ["transit"]=>
179  int(34965)
180  ["civil_twilight_begin"]=>
181  int(15145)
182  ["civil_twilight_end"]=>
183  int(54786)
184  ["nautical_twilight_begin"]=>
185  int(13324)
186  ["nautical_twilight_end"]=>
187  int(56607)
188  ["astronomical_twilight_begin"]=>
189  int(11542)
190  ["astronomical_twilight_end"]=>
191  int(58389)
192}
193
194-- Iteration 6 --
195array(9) {
196  ["sunrise"]=>
197  int(-69665)
198  ["sunset"]=>
199  int(-33260)
200  ["transit"]=>
201  int(-51462)
202  ["civil_twilight_begin"]=>
203  int(-71269)
204  ["civil_twilight_end"]=>
205  int(-31655)
206  ["nautical_twilight_begin"]=>
207  int(-73092)
208  ["nautical_twilight_end"]=>
209  int(-29832)
210  ["astronomical_twilight_begin"]=>
211  int(-74874)
212  ["astronomical_twilight_end"]=>
213  int(-28050)
214}
215
216-- Iteration 7 --
217array(9) {
218  ["sunrise"]=>
219  int(1226363)
220  ["sunset"]=>
221  int(1263468)
222  ["transit"]=>
223  int(1244916)
224  ["civil_twilight_begin"]=>
225  int(1224788)
226  ["civil_twilight_end"]=>
227  int(1265044)
228  ["nautical_twilight_begin"]=>
229  int(1222993)
230  ["nautical_twilight_end"]=>
231  int(1266839)
232  ["astronomical_twilight_begin"]=>
233  int(1221233)
234  ["astronomical_twilight_end"]=>
235  int(1268599)
236}
237
238-- Iteration 8 --
239array(9) {
240  ["sunrise"]=>
241  int(16748)
242  ["sunset"]=>
243  int(53182)
244  ["transit"]=>
245  int(34965)
246  ["civil_twilight_begin"]=>
247  int(15145)
248  ["civil_twilight_end"]=>
249  int(54786)
250  ["nautical_twilight_begin"]=>
251  int(13324)
252  ["nautical_twilight_end"]=>
253  int(56607)
254  ["astronomical_twilight_begin"]=>
255  int(11542)
256  ["astronomical_twilight_end"]=>
257  int(58389)
258}
259
260-- Iteration 9 --
261array(9) {
262  ["sunrise"]=>
263  int(16748)
264  ["sunset"]=>
265  int(53182)
266  ["transit"]=>
267  int(34965)
268  ["civil_twilight_begin"]=>
269  int(15145)
270  ["civil_twilight_end"]=>
271  int(54786)
272  ["nautical_twilight_begin"]=>
273  int(13324)
274  ["nautical_twilight_end"]=>
275  int(56607)
276  ["astronomical_twilight_begin"]=>
277  int(11542)
278  ["astronomical_twilight_end"]=>
279  int(58389)
280}
281
282-- Iteration 10 --
283array(9) {
284  ["sunrise"]=>
285  int(16748)
286  ["sunset"]=>
287  int(53182)
288  ["transit"]=>
289  int(34965)
290  ["civil_twilight_begin"]=>
291  int(15145)
292  ["civil_twilight_end"]=>
293  int(54786)
294  ["nautical_twilight_begin"]=>
295  int(13324)
296  ["nautical_twilight_end"]=>
297  int(56607)
298  ["astronomical_twilight_begin"]=>
299  int(11542)
300  ["astronomical_twilight_end"]=>
301  int(58389)
302}
303
304-- Iteration 11 --
305array(9) {
306  ["sunrise"]=>
307  int(16748)
308  ["sunset"]=>
309  int(53182)
310  ["transit"]=>
311  int(34965)
312  ["civil_twilight_begin"]=>
313  int(15145)
314  ["civil_twilight_end"]=>
315  int(54786)
316  ["nautical_twilight_begin"]=>
317  int(13324)
318  ["nautical_twilight_end"]=>
319  int(56607)
320  ["astronomical_twilight_begin"]=>
321  int(11542)
322  ["astronomical_twilight_end"]=>
323  int(58389)
324}
325
326-- Iteration 12 --
327array(9) {
328  ["sunrise"]=>
329  int(16748)
330  ["sunset"]=>
331  int(53182)
332  ["transit"]=>
333  int(34965)
334  ["civil_twilight_begin"]=>
335  int(15145)
336  ["civil_twilight_end"]=>
337  int(54786)
338  ["nautical_twilight_begin"]=>
339  int(13324)
340  ["nautical_twilight_end"]=>
341  int(56607)
342  ["astronomical_twilight_begin"]=>
343  int(11542)
344  ["astronomical_twilight_end"]=>
345  int(58389)
346}
347
348-- Iteration 13 --
349array(9) {
350  ["sunrise"]=>
351  int(16748)
352  ["sunset"]=>
353  int(53182)
354  ["transit"]=>
355  int(34965)
356  ["civil_twilight_begin"]=>
357  int(15145)
358  ["civil_twilight_end"]=>
359  int(54786)
360  ["nautical_twilight_begin"]=>
361  int(13324)
362  ["nautical_twilight_end"]=>
363  int(56607)
364  ["astronomical_twilight_begin"]=>
365  int(11542)
366  ["astronomical_twilight_end"]=>
367  int(58389)
368}
369
370-- Iteration 14 --
371array(9) {
372  ["sunrise"]=>
373  int(16748)
374  ["sunset"]=>
375  int(53182)
376  ["transit"]=>
377  int(34965)
378  ["civil_twilight_begin"]=>
379  int(15145)
380  ["civil_twilight_end"]=>
381  int(54786)
382  ["nautical_twilight_begin"]=>
383  int(13324)
384  ["nautical_twilight_end"]=>
385  int(56607)
386  ["astronomical_twilight_begin"]=>
387  int(11542)
388  ["astronomical_twilight_end"]=>
389  int(58389)
390}
391
392-- Iteration 15 --
393array(9) {
394  ["sunrise"]=>
395  int(16748)
396  ["sunset"]=>
397  int(53182)
398  ["transit"]=>
399  int(34965)
400  ["civil_twilight_begin"]=>
401  int(15145)
402  ["civil_twilight_end"]=>
403  int(54786)
404  ["nautical_twilight_begin"]=>
405  int(13324)
406  ["nautical_twilight_end"]=>
407  int(56607)
408  ["astronomical_twilight_begin"]=>
409  int(11542)
410  ["astronomical_twilight_end"]=>
411  int(58389)
412}
413
414-- Iteration 16 --
415
416Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
417bool(false)
418
419-- Iteration 17 --
420
421Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
422bool(false)
423
424-- Iteration 18 --
425
426Warning: date_sun_info() expects parameter 1 to be long, array given in %s on line %d
427bool(false)
428
429-- Iteration 19 --
430
431Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
432bool(false)
433
434-- Iteration 20 --
435
436Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
437bool(false)
438
439-- Iteration 21 --
440
441Warning: date_sun_info() expects parameter 1 to be long, string given in %s on line %d
442bool(false)
443
444-- Iteration 22 --
445array(9) {
446  ["sunrise"]=>
447  int(16748)
448  ["sunset"]=>
449  int(53182)
450  ["transit"]=>
451  int(34965)
452  ["civil_twilight_begin"]=>
453  int(15145)
454  ["civil_twilight_end"]=>
455  int(54786)
456  ["nautical_twilight_begin"]=>
457  int(13324)
458  ["nautical_twilight_end"]=>
459  int(56607)
460  ["astronomical_twilight_begin"]=>
461  int(11542)
462  ["astronomical_twilight_end"]=>
463  int(58389)
464}
465
466-- Iteration 23 --
467array(9) {
468  ["sunrise"]=>
469  int(16748)
470  ["sunset"]=>
471  int(53182)
472  ["transit"]=>
473  int(34965)
474  ["civil_twilight_begin"]=>
475  int(15145)
476  ["civil_twilight_end"]=>
477  int(54786)
478  ["nautical_twilight_begin"]=>
479  int(13324)
480  ["nautical_twilight_end"]=>
481  int(56607)
482  ["astronomical_twilight_begin"]=>
483  int(11542)
484  ["astronomical_twilight_end"]=>
485  int(58389)
486}
487
488-- Iteration 24 --
489
490Warning: date_sun_info() expects parameter 1 to be long, resource given in %s on line %d
491bool(false)
492===Done===