xref: /PHP-5.4/ext/session/tests/003.phpt (revision 8deefa87)
1--TEST--
2session object deserialization
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	function method() { $this->yes++; }
17}
18
19session_id("abtest");
20session_start();
21session_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;}}');
22
23$_SESSION["baz"]->method();
24$_SESSION["arr"][3]->method();
25
26var_dump($_SESSION["baz"]);
27var_dump($_SESSION["arr"]);
28session_destroy();
29--EXPECT--
30object(foo)#1 (2) {
31  ["bar"]=>
32  string(2) "ok"
33  ["yes"]=>
34  int(2)
35}
36array(1) {
37  [3]=>
38  object(foo)#2 (2) {
39    ["bar"]=>
40    string(2) "ok"
41    ["yes"]=>
42    int(2)
43  }
44}
45
46