1--TEST--
2Test session_unset() function : error functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10/*
11 * Prototype : void session_unset(void)
12 * Description : Free all session variables
13 * Source code : ext/session/session.c
14 */
15
16echo "*** Testing session_unset() : error functionality ***\n";
17
18// Get an unset variable
19$unset_var = 10;
20unset($unset_var);
21
22class classA
23{
24    public function __toString() {
25        return "Hello World!";
26    }
27}
28
29$heredoc = <<<EOT
30Hello World!
31EOT;
32
33$fp = fopen(__FILE__, "r");
34
35// Unexpected values to be passed as arguments
36$inputs = array(
37
38       // Integer data
39/*1*/  0,
40       1,
41       12345,
42       -2345,
43
44       // Float data
45/*5*/  10.5,
46       -10.5,
47       12.3456789000e10,
48       12.3456789000E-10,
49       .5,
50
51       // Null data
52/*10*/ NULL,
53       null,
54
55       // Boolean data
56/*12*/ true,
57       false,
58       TRUE,
59       FALSE,
60
61       // Empty strings
62/*16*/ "",
63       '',
64
65       // Invalid string data
66/*18*/ "Nothing",
67       'Nothing',
68       $heredoc,
69
70       // Object data
71/*21*/ new classA(),
72
73       // Undefined data
74/*22*/ @$undefined_var,
75
76       // Unset data
77/*23*/ @$unset_var,
78
79       // Resource variable
80/*24*/ $fp
81);
82
83
84$iterator = 1;
85foreach($inputs as $input) {
86    echo "\n-- Iteration $iterator --\n";
87    var_dump(session_unset($input));
88    $iterator++;
89};
90
91fclose($fp);
92echo "Done";
93ob_end_flush();
94?>
95--EXPECTF--
96*** Testing session_unset() : error functionality ***
97
98-- Iteration 1 --
99
100Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
101NULL
102
103-- Iteration 2 --
104
105Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
106NULL
107
108-- Iteration 3 --
109
110Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
111NULL
112
113-- Iteration 4 --
114
115Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
116NULL
117
118-- Iteration 5 --
119
120Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
121NULL
122
123-- Iteration 6 --
124
125Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
126NULL
127
128-- Iteration 7 --
129
130Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
131NULL
132
133-- Iteration 8 --
134
135Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
136NULL
137
138-- Iteration 9 --
139
140Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
141NULL
142
143-- Iteration 10 --
144
145Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
146NULL
147
148-- Iteration 11 --
149
150Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
151NULL
152
153-- Iteration 12 --
154
155Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
156NULL
157
158-- Iteration 13 --
159
160Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
161NULL
162
163-- Iteration 14 --
164
165Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
166NULL
167
168-- Iteration 15 --
169
170Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
171NULL
172
173-- Iteration 16 --
174
175Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
176NULL
177
178-- Iteration 17 --
179
180Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
181NULL
182
183-- Iteration 18 --
184
185Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
186NULL
187
188-- Iteration 19 --
189
190Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
191NULL
192
193-- Iteration 20 --
194
195Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
196NULL
197
198-- Iteration 21 --
199
200Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
201NULL
202
203-- Iteration 22 --
204
205Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
206NULL
207
208-- Iteration 23 --
209
210Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
211NULL
212
213-- Iteration 24 --
214
215Warning: session_unset() expects exactly 0 parameters, 1 given in %s on line 82
216NULL
217Done
218