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