1--TEST--
2Test session_unregister() function : basic functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10/*
11 * Prototype : bool session_unregister(string $name)
12 * Description : Unregister a global variable from the current session
13 * Source code : ext/session/session.c
14 */
15
16echo "*** Testing session_unregister() : basic 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
84var_dump(session_start());
85
86$iterator = 1;
87foreach($inputs as $input) {
88    echo "\n-- Iteration $iterator --\n";
89    var_dump(session_unregister($input));
90    $iterator++;
91};
92
93var_dump(session_destroy());
94
95fclose($fp);
96echo "Done";
97ob_end_flush();
98?>
99--EXPECTF--
100*** Testing session_unregister() : basic functionality ***
101bool(true)
102
103-- Iteration 1 --
104
105Deprecated: Function session_unregister() is deprecated in %s on line %d
106bool(true)
107
108-- Iteration 2 --
109
110Deprecated: Function session_unregister() is deprecated in %s on line %d
111bool(true)
112
113-- Iteration 3 --
114
115Deprecated: Function session_unregister() is deprecated in %s on line %d
116bool(true)
117
118-- Iteration 4 --
119
120Deprecated: Function session_unregister() is deprecated in %s on line %d
121bool(true)
122
123-- Iteration 5 --
124
125Deprecated: Function session_unregister() is deprecated in %s on line %d
126bool(true)
127
128-- Iteration 6 --
129
130Deprecated: Function session_unregister() is deprecated in %s on line %d
131bool(true)
132
133-- Iteration 7 --
134
135Deprecated: Function session_unregister() is deprecated in %s on line %d
136bool(true)
137
138-- Iteration 8 --
139
140Deprecated: Function session_unregister() is deprecated in %s on line %d
141bool(true)
142
143-- Iteration 9 --
144
145Deprecated: Function session_unregister() is deprecated in %s on line %d
146bool(true)
147
148-- Iteration 10 --
149
150Deprecated: Function session_unregister() is deprecated in %s on line %d
151bool(true)
152
153-- Iteration 11 --
154
155Deprecated: Function session_unregister() is deprecated in %s on line %d
156bool(true)
157
158-- Iteration 12 --
159
160Deprecated: Function session_unregister() is deprecated in %s on line %d
161bool(true)
162
163-- Iteration 13 --
164
165Deprecated: Function session_unregister() is deprecated in %s on line %d
166bool(true)
167
168-- Iteration 14 --
169
170Deprecated: Function session_unregister() is deprecated in %s on line %d
171bool(true)
172
173-- Iteration 15 --
174
175Deprecated: Function session_unregister() is deprecated in %s on line %d
176bool(true)
177
178-- Iteration 16 --
179
180Deprecated: Function session_unregister() is deprecated in %s on line %d
181bool(true)
182
183-- Iteration 17 --
184
185Deprecated: Function session_unregister() is deprecated in %s on line %d
186bool(true)
187
188-- Iteration 18 --
189
190Deprecated: Function session_unregister() is deprecated in %s on line %d
191bool(true)
192
193-- Iteration 19 --
194
195Deprecated: Function session_unregister() is deprecated in %s on line %d
196bool(true)
197
198-- Iteration 20 --
199
200Deprecated: Function session_unregister() is deprecated in %s on line %d
201bool(true)
202
203-- Iteration 21 --
204
205Deprecated: Function session_unregister() is deprecated in %s on line %d
206bool(true)
207
208-- Iteration 22 --
209
210Deprecated: Function session_unregister() is deprecated in %s on line %d
211bool(true)
212
213-- Iteration 23 --
214
215Deprecated: Function session_unregister() is deprecated in %s on line %d
216bool(true)
217
218-- Iteration 24 --
219
220Deprecated: Function session_unregister() is deprecated in %s on line %d
221
222Warning: session_unregister() expects parameter 1 to be string, resource given in %s on line %d
223NULL
224bool(true)
225Done
226