xref: /PHP-7.4/ext/session/tests/003.phpt (revision 72f99e66)
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
15var_dump($baz);
16var_dump($arr);
17session_destroy();
18--EXPECT--
19object(foo)(2) {
20  ["bar"]=>
21  string(2) "ok"
22  ["yes"]=>
23  int(1)
24}
25array(1) {
26  [3]=>
27  object(foo)(2) {
28    ["bar"]=>
29    string(2) "ok"
30    ["yes"]=>
31    int(1)
32  }
33}
34