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