xref: /PHP-8.1/ext/session/tests/001.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();
27
28session_start();
29
30$_SESSION["baz"] = $baz;
31$_SESSION["arr"] = $arr;
32
33print session_encode()."\n";
34
35session_destroy();
36?>
37--EXPECT--
38baz|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";}}
39