xref: /PHP-5.3/ext/session/tests/006.phpt (revision 8deefa87)
1--TEST--
2correct instantiation of references between variables in sessions
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.use_cookies=0
7session.cache_limiter=
8register_globals=1
9session.serialize_handler=php
10session.save_handler=files
11--FILE--
12<?php
13error_reporting(E_ALL);
14
15session_id("abtest");
16session_start();
17
18class a {
19    public $test = "hallo";
20}
21
22class b {
23    public $a;
24    function b(&$a) {
25        $this->a = &$a;
26    }
27}
28
29$a = new a();
30$b = new b($a);
31
32echo "original values:\n";
33var_dump($a,$b);
34
35session_register("a");
36session_register("b");
37session_write_close();
38
39session_unregister("a");
40session_unregister("b");
41
42session_start();
43
44echo "values after session:\n";
45var_dump($a,$b);
46?>
47--EXPECTF--
48Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
49original values:
50object(a)#%d (1) {
51  ["test"]=>
52  string(5) "hallo"
53}
54object(b)#%d (1) {
55  ["a"]=>
56  &object(a)#%d (1) {
57    ["test"]=>
58    string(5) "hallo"
59  }
60}
61
62Deprecated: Function session_register() is deprecated in %s on line %d
63
64Deprecated: Function session_register() is deprecated in %s on line %d
65
66Deprecated: Function session_unregister() is deprecated in %s on line %d
67
68Deprecated: Function session_unregister() is deprecated in %s on line %d
69values after session:
70object(a)#%d (1) {
71  ["test"]=>
72  string(5) "hallo"
73}
74object(b)#%d (1) {
75  ["a"]=>
76  &object(a)#%d (1) {
77    ["test"]=>
78    string(5) "hallo"
79  }
80}
81
82