1--TEST-- 2correct instantiation of references between variables in sessions 3--EXTENSIONS-- 4session 5--SKIPIF-- 6<?php include('skipif.inc'); ?> 7--INI-- 8session.use_cookies=0 9session.use_strict_mode=0 10session.cache_limiter= 11session.serialize_handler=php 12session.save_handler=files 13--FILE-- 14<?php 15error_reporting(E_ALL); 16ob_start(); 17 18session_id("test026"); 19session_start(); 20 21class a { 22 public $test = "hallo"; 23} 24 25class b { 26 public $a; 27 function __construct(&$a) { 28 $this->a = &$a; 29 } 30} 31 32$a = new a(); 33$b = new b($a); 34 35echo "original values:\n"; 36var_dump($a,$b); 37 38$_SESSION['a'] = $a; 39$_SESSION['b'] = $b; 40 41session_write_close(); 42unset($_SESSION['a']); 43unset($_SESSION['b']); 44 45session_start(); 46$a = $_SESSION['a']; 47$b = $_SESSION['b']; 48echo "values after session:\n"; 49var_dump($a,$b); 50session_destroy(); 51?> 52--EXPECTF-- 53original values: 54object(a)#%d (1) { 55 ["test"]=> 56 string(5) "hallo" 57} 58object(b)#%d (1) { 59 ["a"]=> 60 &object(a)#%d (1) { 61 ["test"]=> 62 string(5) "hallo" 63 } 64} 65values after session: 66object(a)#%d (1) { 67 ["test"]=> 68 string(5) "hallo" 69} 70object(b)#%d (1) { 71 ["a"]=> 72 &object(a)#%d (1) { 73 ["test"]=> 74 string(5) "hallo" 75 } 76} 77