1--TEST--
2Test session_decode() function : error functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10echo "*** Testing session_decode() : error functionality ***\n";
11$data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
12
13var_dump(session_start());
14for($index = 0; $index < strlen($data); $index++) {
15    if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
16    echo "\n-- Iteration $index --\n";
17    $encoded = substr($data, 0, $index);
18    var_dump(session_decode($encoded));
19    var_dump($_SESSION);
20};
21
22var_dump(session_destroy());
23echo "Done";
24ob_end_flush();
25?>
26--EXPECTF--
27*** Testing session_decode() : error functionality ***
28bool(true)
29
30-- Iteration 0 --
31bool(true)
32array(0) {
33}
34
35-- Iteration 1 --
36
37Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
38bool(false)
39array(0) {
40}
41
42-- Iteration 2 --
43
44Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
45bool(false)
46array(0) {
47}
48
49-- Iteration 3 --
50
51Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
52bool(false)
53array(0) {
54}
55
56-- Iteration 4 --
57
58Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
59bool(false)
60array(0) {
61}
62
63-- Iteration 5 --
64
65Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
66bool(false)
67array(0) {
68}
69
70-- Iteration 6 --
71
72Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
73bool(false)
74array(0) {
75}
76
77-- Iteration 7 --
78
79Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
80bool(false)
81array(0) {
82}
83
84-- Iteration 8 --
85
86Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
87bool(false)
88array(0) {
89}
90
91-- Iteration 9 --
92
93Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
94bool(false)
95array(0) {
96}
97
98-- Iteration 10 --
99
100Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
101bool(false)
102array(0) {
103}
104
105-- Iteration 11 --
106
107Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
108bool(false)
109array(0) {
110}
111
112-- Iteration 12 --
113
114Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
115bool(false)
116array(0) {
117}
118
119-- Iteration 13 --
120
121Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
122bool(false)
123array(0) {
124}
125
126-- Iteration 14 --
127
128Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
129bool(false)
130array(0) {
131}
132
133-- Iteration 15 --
134
135Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
136bool(false)
137array(0) {
138}
139
140-- Iteration 16 --
141
142Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
143bool(false)
144array(0) {
145}
146
147-- Iteration 17 --
148
149Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
150bool(false)
151array(0) {
152}
153
154-- Iteration 18 --
155
156Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
157bool(false)
158array(0) {
159}
160
161-- Iteration 19 --
162
163Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
164bool(false)
165array(0) {
166}
167
168-- Iteration 20 --
169
170Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
171bool(false)
172array(0) {
173}
174
175-- Iteration 21 --
176
177Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
178bool(false)
179array(0) {
180}
181
182-- Iteration 22 --
183
184Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
185bool(false)
186array(0) {
187}
188
189-- Iteration 23 --
190
191Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
192bool(false)
193array(0) {
194}
195
196-- Iteration 24 --
197
198Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
199bool(false)
200array(0) {
201}
202
203-- Iteration 25 --
204
205Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
206bool(false)
207array(0) {
208}
209
210-- Iteration 26 --
211
212Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
213bool(false)
214array(0) {
215}
216
217-- Iteration 27 --
218
219Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
220bool(false)
221array(0) {
222}
223
224-- Iteration 28 --
225
226Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
227bool(false)
228array(0) {
229}
230
231-- Iteration 29 --
232
233Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
234bool(false)
235array(0) {
236}
237
238-- Iteration 30 --
239
240Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
241bool(false)
242array(0) {
243}
244
245-- Iteration 31 --
246
247Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
248bool(false)
249array(0) {
250}
251
252-- Iteration 32 --
253
254Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
255bool(false)
256array(0) {
257}
258
259-- Iteration 33 --
260
261Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
262bool(false)
263array(0) {
264}
265
266-- Iteration 34 --
267bool(true)
268array(1) {
269  ["foo"]=>
270  array(3) {
271    [0]=>
272    int(1)
273    [1]=>
274    int(2)
275    [2]=>
276    int(3)
277  }
278}
279
280-- Iteration 35 --
281
282Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
283bool(false)
284array(0) {
285}
286
287-- Iteration 36 --
288
289Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
290bool(false)
291array(0) {
292}
293
294-- Iteration 37 --
295
296Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
297bool(false)
298array(0) {
299}
300
301-- Iteration 38 --
302
303Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
304bool(false)
305array(0) {
306}
307
308-- Iteration 39 --
309
310Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
311bool(false)
312array(0) {
313}
314
315-- Iteration 40 --
316
317Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
318bool(false)
319array(0) {
320}
321
322-- Iteration 41 --
323
324Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
325bool(false)
326array(0) {
327}
328
329-- Iteration 42 --
330
331Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
332bool(false)
333array(0) {
334}
335
336-- Iteration 43 --
337bool(true)
338array(2) {
339  ["foo"]=>
340  &array(3) {
341    [0]=>
342    int(1)
343    [1]=>
344    int(2)
345    [2]=>
346    int(3)
347  }
348  ["guff"]=>
349  &array(3) {
350    [0]=>
351    int(1)
352    [1]=>
353    int(2)
354    [2]=>
355    int(3)
356  }
357}
358
359-- Iteration 44 --
360
361Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
362bool(false)
363array(0) {
364}
365
366-- Iteration 45 --
367
368Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
369bool(false)
370array(0) {
371}
372
373-- Iteration 46 --
374
375Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
376bool(false)
377array(0) {
378}
379
380-- Iteration 47 --
381
382Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
383bool(false)
384array(0) {
385}
386
387-- Iteration 48 --
388
389Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
390bool(false)
391array(0) {
392}
393
394-- Iteration 49 --
395
396Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
397bool(false)
398array(0) {
399}
400
401-- Iteration 50 --
402
403Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
404bool(false)
405array(0) {
406}
407
408-- Iteration 51 --
409
410Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
411bool(false)
412array(0) {
413}
414
415Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
416bool(false)
417Done
418