xref: /PHP-8.1/ext/session/tests/022.phpt (revision b5a14e6c)
1--TEST--
2session object serialization
3--EXTENSIONS--
4session
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--INI--
8session.use_cookies=0
9session.cache_limiter=
10session.serialize_handler=php
11session.save_handler=files
12--FILE--
13<?php
14error_reporting(E_ALL);
15
16class foo {
17    public $bar = "ok";
18
19    function method() { $this->yes = "done"; }
20}
21
22$baz = new foo;
23$baz->method();
24
25$arr[3] = new foo;
26$arr[3]->method();
27session_start();
28$_SESSION["baz"] = $baz;
29$_SESSION["arr"] = $arr;
30var_dump(session_encode());
31session_destroy();
32?>
33--EXPECT--
34string(126) "baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";s:4:"done";}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";s:4:"done";}}"
35