xref: /php-src/ext/session/tests/023.phpt (revision adb45a63)
1--TEST--
2session object deserialization
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);
16
17class foo {
18    public $bar = "ok";
19    public $yes;
20    function method() { $this->yes++; }
21}
22
23session_id("test023");
24session_start();
25session_decode('baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}');
26$baz = $_SESSION['baz'];
27$arr = $_SESSION['arr'];
28
29$baz->method();
30$arr[3]->method();
31
32var_dump($baz);
33var_dump($arr);
34session_destroy();
35?>
36--EXPECT--
37object(foo)#1 (2) {
38  ["bar"]=>
39  string(2) "ok"
40  ["yes"]=>
41  int(2)
42}
43array(1) {
44  [3]=>
45  object(foo)#2 (2) {
46    ["bar"]=>
47    string(2) "ok"
48    ["yes"]=>
49    int(2)
50  }
51}
52