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_is_registered(string $name)
12 * Description : Find out whether a global variable is registered in a session
13 * Source code : ext/session/session.c
14 */
15
16echo "*** Testing session_is_registered() : 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
84$iterator = 1;
85foreach($inputs as $input) {
86    echo "\n-- Iteration $iterator --\n";
87    var_dump(session_start());
88    var_dump(session_is_registered($input));
89    var_dump($_SESSION);
90    var_dump(session_destroy());
91    $iterator++;
92};
93
94fclose($fp);
95echo "Done";
96ob_end_flush();
97?>
98--EXPECTF--
99*** Testing session_is_registered() : basic functionality ***
100
101-- Iteration 1 --
102bool(true)
103
104Deprecated: Function session_is_registered() is deprecated in %s on line %d
105bool(false)
106array(0) {
107}
108bool(true)
109
110-- Iteration 2 --
111bool(true)
112
113Deprecated: Function session_is_registered() is deprecated in %s on line %d
114bool(false)
115array(0) {
116}
117bool(true)
118
119-- Iteration 3 --
120bool(true)
121
122Deprecated: Function session_is_registered() is deprecated in %s on line %d
123bool(false)
124array(0) {
125}
126bool(true)
127
128-- Iteration 4 --
129bool(true)
130
131Deprecated: Function session_is_registered() is deprecated in %s on line %d
132bool(false)
133array(0) {
134}
135bool(true)
136
137-- Iteration 5 --
138bool(true)
139
140Deprecated: Function session_is_registered() is deprecated in %s on line %d
141bool(false)
142array(0) {
143}
144bool(true)
145
146-- Iteration 6 --
147bool(true)
148
149Deprecated: Function session_is_registered() is deprecated in %s on line %d
150bool(false)
151array(0) {
152}
153bool(true)
154
155-- Iteration 7 --
156bool(true)
157
158Deprecated: Function session_is_registered() is deprecated in %s on line %d
159bool(false)
160array(0) {
161}
162bool(true)
163
164-- Iteration 8 --
165bool(true)
166
167Deprecated: Function session_is_registered() is deprecated in %s on line %d
168bool(false)
169array(0) {
170}
171bool(true)
172
173-- Iteration 9 --
174bool(true)
175
176Deprecated: Function session_is_registered() is deprecated in %s on line %d
177bool(false)
178array(0) {
179}
180bool(true)
181
182-- Iteration 10 --
183bool(true)
184
185Deprecated: Function session_is_registered() is deprecated in %s on line %d
186bool(false)
187array(0) {
188}
189bool(true)
190
191-- Iteration 11 --
192bool(true)
193
194Deprecated: Function session_is_registered() is deprecated in %s on line %d
195bool(false)
196array(0) {
197}
198bool(true)
199
200-- Iteration 12 --
201bool(true)
202
203Deprecated: Function session_is_registered() is deprecated in %s on line %d
204bool(false)
205array(0) {
206}
207bool(true)
208
209-- Iteration 13 --
210bool(true)
211
212Deprecated: Function session_is_registered() is deprecated in %s on line %d
213bool(false)
214array(0) {
215}
216bool(true)
217
218-- Iteration 14 --
219bool(true)
220
221Deprecated: Function session_is_registered() is deprecated in %s on line %d
222bool(false)
223array(0) {
224}
225bool(true)
226
227-- Iteration 15 --
228bool(true)
229
230Deprecated: Function session_is_registered() is deprecated in %s on line %d
231bool(false)
232array(0) {
233}
234bool(true)
235
236-- Iteration 16 --
237bool(true)
238
239Deprecated: Function session_is_registered() is deprecated in %s on line %d
240bool(false)
241array(0) {
242}
243bool(true)
244
245-- Iteration 17 --
246bool(true)
247
248Deprecated: Function session_is_registered() is deprecated in %s on line %d
249bool(false)
250array(0) {
251}
252bool(true)
253
254-- Iteration 18 --
255bool(true)
256
257Deprecated: Function session_is_registered() is deprecated in %s on line %d
258bool(false)
259array(0) {
260}
261bool(true)
262
263-- Iteration 19 --
264bool(true)
265
266Deprecated: Function session_is_registered() is deprecated in %s on line %d
267bool(false)
268array(0) {
269}
270bool(true)
271
272-- Iteration 20 --
273bool(true)
274
275Deprecated: Function session_is_registered() is deprecated in %s on line %d
276bool(false)
277array(0) {
278}
279bool(true)
280
281-- Iteration 21 --
282bool(true)
283
284Deprecated: Function session_is_registered() is deprecated in %s on line %d
285bool(false)
286array(0) {
287}
288bool(true)
289
290-- Iteration 22 --
291bool(true)
292
293Deprecated: Function session_is_registered() is deprecated in %s on line %d
294bool(false)
295array(0) {
296}
297bool(true)
298
299-- Iteration 23 --
300bool(true)
301
302Deprecated: Function session_is_registered() is deprecated in %s on line %d
303bool(false)
304array(0) {
305}
306bool(true)
307
308-- Iteration 24 --
309bool(true)
310
311Deprecated: Function session_is_registered() is deprecated in %s on line %d
312
313Warning: session_is_registered() expects parameter 1 to be string, resource given in %s on line %d
314NULL
315array(0) {
316}
317bool(true)
318Done
319