xref: /PHP-5.3/ext/session/tests/023.phpt (revision 57e0d2ac)
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$baz = $_SESSION['baz'];
23$arr = $_SESSION['arr'];
24
25$baz->method();
26$arr[3]->method();
27
28var_dump($baz);
29var_dump($arr);
30session_destroy();
31--EXPECT--
32object(foo)#1 (2) {
33  ["bar"]=>
34  string(2) "ok"
35  ["yes"]=>
36  int(2)
37}
38array(1) {
39  [3]=>
40  object(foo)#2 (2) {
41    ["bar"]=>
42    string(2) "ok"
43    ["yes"]=>
44    int(2)
45  }
46}
47