1--TEST-- 2serializing references test case using globals 3--SKIPIF-- 4<?php include('skipif.inc'); ?> 5--INI-- 6session.use_cookies=0 7session.use_strict_mode=0 8session.cache_limiter= 9session.serialize_handler=php 10session.save_handler=files 11--FILE-- 12<?php 13 14error_reporting(E_ALL); 15 16class TFoo { 17 public $c; 18 function TFoo($c) { 19 $this->c = $c; 20 } 21 function inc() { 22 $this->c++; 23 } 24} 25 26session_id("abtest"); 27session_start(); 28 29$_SESSION["o1"] = new TFoo(42); 30$_SESSION["o2"] =& $_SESSION["o1"]; 31 32session_write_close(); 33 34unset($_SESSION["o1"]); 35unset($_SESSION["o2"]); 36 37session_start(); 38 39var_dump($_SESSION); 40 41$_SESSION["o1"]->inc(); 42$_SESSION["o2"]->inc(); 43 44var_dump($_SESSION); 45 46session_destroy(); 47?> 48--EXPECTF-- 49 50array(2) { 51 ["o1"]=> 52 &object(TFoo)#%d (1) { 53 ["c"]=> 54 int(42) 55 } 56 ["o2"]=> 57 &object(TFoo)#%d (1) { 58 ["c"]=> 59 int(42) 60 } 61} 62array(2) { 63 ["o1"]=> 64 &object(TFoo)#%d (1) { 65 ["c"]=> 66 int(44) 67 } 68 ["o2"]=> 69 &object(TFoo)#%d (1) { 70 ["c"]=> 71 int(44) 72 } 73} 74 75