xref: /php-src/ext/session/tests/bug71972.phpt (revision b5a14e6c)
1--TEST--
2Bug #71972 (Cyclic references causing session_start(): Failed to decode session object)
3--EXTENSIONS--
4session
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--INI--
8session.save_handler=files
9--FILE--
10<?php
11ob_start();
12session_start();
13
14$_SESSION['boogie'] = 1;
15
16$_SESSION['obj1'] = new stdClass();
17for ( $x=2; $x < 20; $x++) {
18    cyclic_ref($x);
19}
20
21function cyclic_ref($num) {
22    $_SESSION['obj'.$num] = new stdClass();
23    $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too.
24    $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1'];
25}
26
27var_dump(session_decode(session_encode()) == $_SESSION);
28?>
29--EXPECT--
30bool(true)
31