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