1--TEST--
2Test imap_close() function : usage variations - different data types as $stream_id arg
3--SKIPIF--
4<?php
5extension_loaded('imap') or die('skip imap extension not available in this build');
6?>
7--FILE--
8<?php
9/* Prototype  : bool imap_close(resource $stream_id [, int $options])
10 * Description: Close an IMAP stream
11 * Source code: ext/imap/php_imap.c
12 */
13
14/*
15 * Pass different data types as $stream_id argument to test behaviour of imap_close()
16 */
17
18echo "*** Testing imap_close() : usage variations ***\n";
19
20//get an unset variable
21$unset_var = 10;
22unset ($unset_var);
23
24// get a class
25class classA
26{
27  public function __toString() {
28    return "Class A object";
29  }
30}
31
32// heredoc string
33$heredoc = <<<EOT
34hello world
35EOT;
36
37// unexpected values to be passed to $stream_id argument
38$inputs = array(
39
40       // int data
41/*1*/  0,
42       1,
43       12345,
44       -2345,
45
46       // float data
47/*5*/  10.5,
48       -10.5,
49       12.3456789000e10,
50       12.3456789000E-10,
51       .5,
52
53       // null data
54/*10*/ NULL,
55       null,
56
57       // boolean data
58/*12*/ true,
59       false,
60       TRUE,
61       FALSE,
62
63       // empty data
64/*16*/ "",
65       '',
66       array(),
67
68       // string data
69/*19*/ "string",
70       'string',
71       $heredoc,
72
73       // object data
74/*22*/ new classA(),
75
76       // undefined data
77/*23*/ @$undefined_var,
78
79       // unset data
80/*24*/ @$unset_var,
81);
82
83// loop through each element of $inputs to check the behavior of imap_close()
84$iterator = 1;
85foreach($inputs as $input) {
86  echo "\n-- Iteration $iterator --\n";
87  var_dump( imap_close($input) );
88  $iterator++;
89};
90?>
91===DONE===
92--EXPECTF--
93*** Testing imap_close() : usage variations ***
94
95-- Iteration 1 --
96
97Warning: imap_close() expects parameter 1 to be resource, integer given in %simap_close_variation1.php on line 80
98NULL
99
100-- Iteration 2 --
101
102Warning: imap_close() expects parameter 1 to be resource, integer given in %simap_close_variation1.php on line 80
103NULL
104
105-- Iteration 3 --
106
107Warning: imap_close() expects parameter 1 to be resource, integer given in %simap_close_variation1.php on line 80
108NULL
109
110-- Iteration 4 --
111
112Warning: imap_close() expects parameter 1 to be resource, integer given in %simap_close_variation1.php on line 80
113NULL
114
115-- Iteration 5 --
116
117Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80
118NULL
119
120-- Iteration 6 --
121
122Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80
123NULL
124
125-- Iteration 7 --
126
127Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80
128NULL
129
130-- Iteration 8 --
131
132Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80
133NULL
134
135-- Iteration 9 --
136
137Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80
138NULL
139
140-- Iteration 10 --
141
142Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80
143NULL
144
145-- Iteration 11 --
146
147Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80
148NULL
149
150-- Iteration 12 --
151
152Warning: imap_close() expects parameter 1 to be resource, boolean given in %simap_close_variation1.php on line 80
153NULL
154
155-- Iteration 13 --
156
157Warning: imap_close() expects parameter 1 to be resource, boolean given in %simap_close_variation1.php on line 80
158NULL
159
160-- Iteration 14 --
161
162Warning: imap_close() expects parameter 1 to be resource, boolean given in %simap_close_variation1.php on line 80
163NULL
164
165-- Iteration 15 --
166
167Warning: imap_close() expects parameter 1 to be resource, boolean given in %simap_close_variation1.php on line 80
168NULL
169
170-- Iteration 16 --
171
172Warning: imap_close() expects parameter 1 to be resource, %unicode_string_optional% given in %simap_close_variation1.php on line 80
173NULL
174
175-- Iteration 17 --
176
177Warning: imap_close() expects parameter 1 to be resource, %unicode_string_optional% given in %simap_close_variation1.php on line 80
178NULL
179
180-- Iteration 18 --
181
182Warning: imap_close() expects parameter 1 to be resource, array given in %simap_close_variation1.php on line 80
183NULL
184
185-- Iteration 19 --
186
187Warning: imap_close() expects parameter 1 to be resource, %unicode_string_optional% given in %simap_close_variation1.php on line 80
188NULL
189
190-- Iteration 20 --
191
192Warning: imap_close() expects parameter 1 to be resource, %unicode_string_optional% given in %simap_close_variation1.php on line 80
193NULL
194
195-- Iteration 21 --
196
197Warning: imap_close() expects parameter 1 to be resource, %unicode_string_optional% given in %simap_close_variation1.php on line 80
198NULL
199
200-- Iteration 22 --
201
202Warning: imap_close() expects parameter 1 to be resource, object given in %simap_close_variation1.php on line 80
203NULL
204
205-- Iteration 23 --
206
207Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80
208NULL
209
210-- Iteration 24 --
211
212Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80
213NULL
214===DONE===
215