xref: /PHP-7.4/ext/session/tests/003.phpt (revision 8882b28e)
1--TEST--
2session object deserialization
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.use_cookies=0
7session.cache_limiter=
8register_globals=1
9--FILE--
10<?php
11error_reporting(E_ALL);
12
13class foo {
14	var $bar = "ok";
15	function method() { $this->yes++; }
16}
17
18session_id("abtest");
19session_start();
20session_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;}}');
21
22$baz->method();
23$arr[3]->method();
24
25var_dump($baz);
26var_dump($arr);
27session_destroy();
28--EXPECT--
29object(foo)(2) {
30  ["bar"]=>
31  string(2) "ok"
32  ["yes"]=>
33  int(2)
34}
35array(1) {
36  [3]=>
37  &object(foo)(2) {
38    ["bar"]=>
39    string(2) "ok"
40    ["yes"]=>
41    int(2)
42  }
43}
44