1--TEST--
2Test session_decode() function : error functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10/*
11 * Prototype : string session_decode(void)
12 * Description : Decodes session data from a string
13 * Source code : ext/session/session.c
14 */
15
16echo "*** Testing session_decode() : error functionality ***\n";
17$data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
18
19var_dump(session_start());
20for($index = 0; $index < strlen($data); $index++) {
21	if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
22    echo "\n-- Iteration $index --\n";
23    $encoded = substr($data, 0, $index);
24    var_dump(session_decode($encoded));
25    var_dump($_SESSION);
26};
27
28var_dump(session_destroy());
29echo "Done";
30ob_end_flush();
31?>
32--EXPECTF--
33*** Testing session_decode() : error functionality ***
34bool(true)
35
36-- Iteration 0 --
37bool(true)
38array(0) {
39}
40
41-- Iteration 1 --
42bool(true)
43array(0) {
44}
45
46-- Iteration 2 --
47bool(true)
48array(0) {
49}
50
51-- Iteration 3 --
52bool(true)
53array(0) {
54}
55
56-- Iteration 4 --
57
58Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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%esession_decode_error2.php 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 --
281bool(true)
282array(1) {
283  ["foo"]=>
284  array(3) {
285    [0]=>
286    int(1)
287    [1]=>
288    int(2)
289    [2]=>
290    int(3)
291  }
292}
293
294-- Iteration 36 --
295bool(true)
296array(1) {
297  ["foo"]=>
298  array(3) {
299    [0]=>
300    int(1)
301    [1]=>
302    int(2)
303    [2]=>
304    int(3)
305  }
306}
307
308-- Iteration 37 --
309bool(true)
310array(1) {
311  ["foo"]=>
312  array(3) {
313    [0]=>
314    int(1)
315    [1]=>
316    int(2)
317    [2]=>
318    int(3)
319  }
320}
321
322-- Iteration 38 --
323bool(true)
324array(1) {
325  ["foo"]=>
326  array(3) {
327    [0]=>
328    int(1)
329    [1]=>
330    int(2)
331    [2]=>
332    int(3)
333  }
334}
335
336-- Iteration 39 --
337
338Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
339bool(false)
340array(0) {
341}
342
343-- Iteration 40 --
344
345Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
346bool(false)
347array(0) {
348}
349
350-- Iteration 41 --
351
352Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
353bool(false)
354array(0) {
355}
356
357-- Iteration 42 --
358
359Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
360bool(false)
361array(0) {
362}
363
364-- Iteration 43 --
365bool(true)
366array(2) {
367  ["foo"]=>
368  &array(3) {
369    [0]=>
370    int(1)
371    [1]=>
372    int(2)
373    [2]=>
374    int(3)
375  }
376  ["guff"]=>
377  &array(3) {
378    [0]=>
379    int(1)
380    [1]=>
381    int(2)
382    [2]=>
383    int(3)
384  }
385}
386
387-- Iteration 44 --
388bool(true)
389array(2) {
390  ["foo"]=>
391  &array(3) {
392    [0]=>
393    int(1)
394    [1]=>
395    int(2)
396    [2]=>
397    int(3)
398  }
399  ["guff"]=>
400  &array(3) {
401    [0]=>
402    int(1)
403    [1]=>
404    int(2)
405    [2]=>
406    int(3)
407  }
408}
409
410-- Iteration 45 --
411bool(true)
412array(2) {
413  ["foo"]=>
414  &array(3) {
415    [0]=>
416    int(1)
417    [1]=>
418    int(2)
419    [2]=>
420    int(3)
421  }
422  ["guff"]=>
423  &array(3) {
424    [0]=>
425    int(1)
426    [1]=>
427    int(2)
428    [2]=>
429    int(3)
430  }
431}
432
433-- Iteration 46 --
434bool(true)
435array(2) {
436  ["foo"]=>
437  &array(3) {
438    [0]=>
439    int(1)
440    [1]=>
441    int(2)
442    [2]=>
443    int(3)
444  }
445  ["guff"]=>
446  &array(3) {
447    [0]=>
448    int(1)
449    [1]=>
450    int(2)
451    [2]=>
452    int(3)
453  }
454}
455
456-- Iteration 47 --
457bool(true)
458array(2) {
459  ["foo"]=>
460  &array(3) {
461    [0]=>
462    int(1)
463    [1]=>
464    int(2)
465    [2]=>
466    int(3)
467  }
468  ["guff"]=>
469  &array(3) {
470    [0]=>
471    int(1)
472    [1]=>
473    int(2)
474    [2]=>
475    int(3)
476  }
477}
478
479-- Iteration 48 --
480
481Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
482bool(false)
483array(0) {
484}
485
486-- Iteration 49 --
487
488Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
489bool(false)
490array(0) {
491}
492
493-- Iteration 50 --
494
495Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
496bool(false)
497array(0) {
498}
499
500-- Iteration 51 --
501
502Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
503bool(false)
504array(0) {
505}
506
507Warning: session_destroy(): Trying to destroy uninitialized session in %s%esession_decode_error2.php on line %d
508bool(false)
509Done
510