xref: /PHP-7.4/ext/session/tests/003.phpt (revision d64db734)
1--TEST--
2session object deserialization
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.use_cookies=0
7session.cache_limiter=
8register_globals=1
9session.serialize_handler=php
10session.save_handler=files
11--FILE--
12<?php
13error_reporting(E_ALL);
14
15class foo {
16	public $bar = "ok";
17	function method() { $this->yes++; }
18}
19
20session_id("abtest");
21session_start();
22session_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;}}');
23
24$baz->method();
25$arr[3]->method();
26
27var_dump($baz);
28var_dump($arr);
29session_destroy();
30--EXPECT--
31PHP Warning:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
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
48