xref: /PHP-7.4/ext/session/tests/003.phpt (revision 80ff1a38)
1--TEST--
2Session Object Deserialization
3--FILE--
4<?
5
6class foo {
7	var $bar = "ok";
8	function method() { $this->yes++; }
9}
10
11session_id("test");
12session_start();
13session_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;}}');
14
15$baz->method();
16$arr[3]->method();
17
18var_dump($baz);
19var_dump($arr);
20session_destroy();
21--EXPECT--
22object(foo)(2) {
23  ["bar"]=>
24  string(2) "ok"
25  ["yes"]=>
26  int(2)
27}
28array(1) {
29  [3]=>
30  &object(foo)(2) {
31    ["bar"]=>
32    string(2) "ok"
33    ["yes"]=>
34    int(2)
35  }
36}
37