xref: /PHP-8.4/ext/session/tests/001.phpt (revision 902d6439)
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
16#[AllowDynamicProperties]
17class foo {
18    public $bar = "ok";
19
20    function method() { $this->yes = "done"; }
21}
22
23$baz = new foo;
24$baz->method();
25
26$arr[3] = new foo;
27$arr[3]->method();
28
29session_start();
30
31$_SESSION["baz"] = $baz;
32$_SESSION["arr"] = $arr;
33
34print session_encode()."\n";
35
36session_destroy();
37?>
38--EXPECT--
39baz|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";}}
40