1--TEST--
2Test date_sun_info() function : usage variations - Pass unexpected values for longitude 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.3456789000e10,
38       12.3456789000E-10,
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;
73
74foreach($inputs as $input) {
75    echo "\n-- Iteration $iterator --\n";
76    var_dump(date_sun_info(strtotime("2006-12-12"), 31.7667, $input));
77    $iterator++;
78};
79
80?>
81===Done===
82--EXPECTF--
83*** Testing date_sun_info() : usage variations ***
84
85-- Iteration 1 --
86array(9) {
87  ["sunrise"]=>
88  int(1165906242)
89  ["sunset"]=>
90  int(1165942625)
91  ["transit"]=>
92  int(1165924434)
93  ["civil_twilight_begin"]=>
94  int(1165904636)
95  ["civil_twilight_end"]=>
96  int(1165944231)
97  ["nautical_twilight_begin"]=>
98  int(1165902813)
99  ["nautical_twilight_end"]=>
100  int(1165946054)
101  ["astronomical_twilight_begin"]=>
102  int(1165901030)
103  ["astronomical_twilight_end"]=>
104  int(1165947838)
105}
106
107-- Iteration 2 --
108array(9) {
109  ["sunrise"]=>
110  int(1165906002)
111  ["sunset"]=>
112  int(1165942385)
113  ["transit"]=>
114  int(1165924194)
115  ["civil_twilight_begin"]=>
116  int(1165904396)
117  ["civil_twilight_end"]=>
118  int(1165943991)
119  ["nautical_twilight_begin"]=>
120  int(1165902573)
121  ["nautical_twilight_end"]=>
122  int(1165945814)
123  ["astronomical_twilight_begin"]=>
124  int(1165900789)
125  ["astronomical_twilight_end"]=>
126  int(1165947598)
127}
128
129-- Iteration 3 --
130array(9) {
131  ["sunrise"]=>
132  int(1165879335)
133  ["sunset"]=>
134  int(1165917916)
135  ["transit"]=>
136  int(1165898625)
137  ["civil_twilight_begin"]=>
138  int(1165877811)
139  ["civil_twilight_end"]=>
140  int(1165919440)
141  ["nautical_twilight_begin"]=>
142  int(1165876064)
143  ["nautical_twilight_end"]=>
144  int(1165921187)
145  ["astronomical_twilight_begin"]=>
146  int(1165874341)
147  ["astronomical_twilight_end"]=>
148  int(1165922910)
149}
150
151-- Iteration 4 --
152array(9) {
153  ["sunrise"]=>
154  int(1165864483)
155  ["sunset"]=>
156  int(1165900762)
157  ["transit"]=>
158  int(1165882623)
159  ["civil_twilight_begin"]=>
160  int(1165862873)
161  ["civil_twilight_end"]=>
162  int(1165902372)
163  ["nautical_twilight_begin"]=>
164  int(1165861045)
165  ["nautical_twilight_end"]=>
166  int(1165904200)
167  ["astronomical_twilight_begin"]=>
168  int(1165859259)
169  ["astronomical_twilight_end"]=>
170  int(1165905987)
171}
172
173-- Iteration 5 --
174array(9) {
175  ["sunrise"]=>
176  int(1165903721)
177  ["sunset"]=>
178  int(1165940105)
179  ["transit"]=>
180  int(1165921913)
181  ["civil_twilight_begin"]=>
182  int(1165902115)
183  ["civil_twilight_end"]=>
184  int(1165941711)
185  ["nautical_twilight_begin"]=>
186  int(1165900292)
187  ["nautical_twilight_end"]=>
188  int(1165943534)
189  ["astronomical_twilight_begin"]=>
190  int(1165898508)
191  ["astronomical_twilight_end"]=>
192  int(1165945317)
193}
194
195-- Iteration 6 --
196array(9) {
197  ["sunrise"]=>
198  int(1165908763)
199  ["sunset"]=>
200  int(1165945146)
201  ["transit"]=>
202  int(1165926954)
203  ["civil_twilight_begin"]=>
204  int(1165907157)
205  ["civil_twilight_end"]=>
206  int(1165946752)
207  ["nautical_twilight_begin"]=>
208  int(1165905334)
209  ["nautical_twilight_end"]=>
210  int(1165948575)
211  ["astronomical_twilight_begin"]=>
212  int(1165903551)
213  ["astronomical_twilight_end"]=>
214  int(1165950358)
215}
216
217-- Iteration 7 --
218array(9) {
219  ["sunrise"]=>
220  int(1165919856)
221  ["sunset"]=>
222  int(1165969985)
223  ["transit"]=>
224  int(1165944920)
225  ["civil_twilight_begin"]=>
226  int(1165918203)
227  ["civil_twilight_end"]=>
228  int(1165971638)
229  ["nautical_twilight_begin"]=>
230  int(1165916223)
231  ["nautical_twilight_end"]=>
232  int(1165973617)
233  ["astronomical_twilight_begin"]=>
234  int(1165914116)
235  ["astronomical_twilight_end"]=>
236  int(1165975725)
237}
238
239-- Iteration 8 --
240array(9) {
241  ["sunrise"]=>
242  int(1165906242)
243  ["sunset"]=>
244  int(1165942625)
245  ["transit"]=>
246  int(1165924434)
247  ["civil_twilight_begin"]=>
248  int(1165904636)
249  ["civil_twilight_end"]=>
250  int(1165944231)
251  ["nautical_twilight_begin"]=>
252  int(1165902813)
253  ["nautical_twilight_end"]=>
254  int(1165946054)
255  ["astronomical_twilight_begin"]=>
256  int(1165901030)
257  ["astronomical_twilight_end"]=>
258  int(1165947838)
259}
260
261-- Iteration 9 --
262array(9) {
263  ["sunrise"]=>
264  int(1165906122)
265  ["sunset"]=>
266  int(1165942505)
267  ["transit"]=>
268  int(1165924314)
269  ["civil_twilight_begin"]=>
270  int(1165904516)
271  ["civil_twilight_end"]=>
272  int(1165944111)
273  ["nautical_twilight_begin"]=>
274  int(1165902693)
275  ["nautical_twilight_end"]=>
276  int(1165945934)
277  ["astronomical_twilight_begin"]=>
278  int(1165900910)
279  ["astronomical_twilight_end"]=>
280  int(1165947718)
281}
282
283-- Iteration 10 --
284array(9) {
285  ["sunrise"]=>
286  int(1165906242)
287  ["sunset"]=>
288  int(1165942625)
289  ["transit"]=>
290  int(1165924434)
291  ["civil_twilight_begin"]=>
292  int(1165904636)
293  ["civil_twilight_end"]=>
294  int(1165944231)
295  ["nautical_twilight_begin"]=>
296  int(1165902813)
297  ["nautical_twilight_end"]=>
298  int(1165946054)
299  ["astronomical_twilight_begin"]=>
300  int(1165901030)
301  ["astronomical_twilight_end"]=>
302  int(1165947838)
303}
304
305-- Iteration 11 --
306array(9) {
307  ["sunrise"]=>
308  int(1165906242)
309  ["sunset"]=>
310  int(1165942625)
311  ["transit"]=>
312  int(1165924434)
313  ["civil_twilight_begin"]=>
314  int(1165904636)
315  ["civil_twilight_end"]=>
316  int(1165944231)
317  ["nautical_twilight_begin"]=>
318  int(1165902813)
319  ["nautical_twilight_end"]=>
320  int(1165946054)
321  ["astronomical_twilight_begin"]=>
322  int(1165901030)
323  ["astronomical_twilight_end"]=>
324  int(1165947838)
325}
326
327-- Iteration 12 --
328array(9) {
329  ["sunrise"]=>
330  int(1165906002)
331  ["sunset"]=>
332  int(1165942385)
333  ["transit"]=>
334  int(1165924194)
335  ["civil_twilight_begin"]=>
336  int(1165904396)
337  ["civil_twilight_end"]=>
338  int(1165943991)
339  ["nautical_twilight_begin"]=>
340  int(1165902573)
341  ["nautical_twilight_end"]=>
342  int(1165945814)
343  ["astronomical_twilight_begin"]=>
344  int(1165900789)
345  ["astronomical_twilight_end"]=>
346  int(1165947598)
347}
348
349-- Iteration 13 --
350array(9) {
351  ["sunrise"]=>
352  int(1165906242)
353  ["sunset"]=>
354  int(1165942625)
355  ["transit"]=>
356  int(1165924434)
357  ["civil_twilight_begin"]=>
358  int(1165904636)
359  ["civil_twilight_end"]=>
360  int(1165944231)
361  ["nautical_twilight_begin"]=>
362  int(1165902813)
363  ["nautical_twilight_end"]=>
364  int(1165946054)
365  ["astronomical_twilight_begin"]=>
366  int(1165901030)
367  ["astronomical_twilight_end"]=>
368  int(1165947838)
369}
370
371-- Iteration 14 --
372array(9) {
373  ["sunrise"]=>
374  int(1165906002)
375  ["sunset"]=>
376  int(1165942385)
377  ["transit"]=>
378  int(1165924194)
379  ["civil_twilight_begin"]=>
380  int(1165904396)
381  ["civil_twilight_end"]=>
382  int(1165943991)
383  ["nautical_twilight_begin"]=>
384  int(1165902573)
385  ["nautical_twilight_end"]=>
386  int(1165945814)
387  ["astronomical_twilight_begin"]=>
388  int(1165900789)
389  ["astronomical_twilight_end"]=>
390  int(1165947598)
391}
392
393-- Iteration 15 --
394array(9) {
395  ["sunrise"]=>
396  int(1165906242)
397  ["sunset"]=>
398  int(1165942625)
399  ["transit"]=>
400  int(1165924434)
401  ["civil_twilight_begin"]=>
402  int(1165904636)
403  ["civil_twilight_end"]=>
404  int(1165944231)
405  ["nautical_twilight_begin"]=>
406  int(1165902813)
407  ["nautical_twilight_end"]=>
408  int(1165946054)
409  ["astronomical_twilight_begin"]=>
410  int(1165901030)
411  ["astronomical_twilight_end"]=>
412  int(1165947838)
413}
414
415-- Iteration 16 --
416
417Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d
418bool(false)
419
420-- Iteration 17 --
421
422Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d
423bool(false)
424
425-- Iteration 18 --
426
427Warning: date_sun_info() expects parameter 3 to be float, array given in %s on line %d
428bool(false)
429
430-- Iteration 19 --
431
432Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d
433bool(false)
434
435-- Iteration 20 --
436
437Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d
438bool(false)
439
440-- Iteration 21 --
441
442Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d
443bool(false)
444
445-- Iteration 22 --
446array(9) {
447  ["sunrise"]=>
448  int(1165906242)
449  ["sunset"]=>
450  int(1165942625)
451  ["transit"]=>
452  int(1165924434)
453  ["civil_twilight_begin"]=>
454  int(1165904636)
455  ["civil_twilight_end"]=>
456  int(1165944231)
457  ["nautical_twilight_begin"]=>
458  int(1165902813)
459  ["nautical_twilight_end"]=>
460  int(1165946054)
461  ["astronomical_twilight_begin"]=>
462  int(1165901030)
463  ["astronomical_twilight_end"]=>
464  int(1165947838)
465}
466
467-- Iteration 23 --
468array(9) {
469  ["sunrise"]=>
470  int(1165906242)
471  ["sunset"]=>
472  int(1165942625)
473  ["transit"]=>
474  int(1165924434)
475  ["civil_twilight_begin"]=>
476  int(1165904636)
477  ["civil_twilight_end"]=>
478  int(1165944231)
479  ["nautical_twilight_begin"]=>
480  int(1165902813)
481  ["nautical_twilight_end"]=>
482  int(1165946054)
483  ["astronomical_twilight_begin"]=>
484  int(1165901030)
485  ["astronomical_twilight_end"]=>
486  int(1165947838)
487}
488
489-- Iteration 24 --
490
491Warning: date_sun_info() expects parameter 3 to be float, resource given in %s on line %d
492bool(false)
493===Done===
494