summaryrefslogtreecommitdiff
path: root/ext/session/tests/003.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session/tests/003.phpt')
-rw-r--r--ext/session/tests/003.phpt45
1 files changed, 45 insertions, 0 deletions
diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt
new file mode 100644
index 0000000..03c3b95
--- /dev/null
+++ b/ext/session/tests/003.phpt
@@ -0,0 +1,45 @@
+--TEST--
+session object deserialization
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+class foo {
+ public $bar = "ok";
+ function method() { $this->yes++; }
+}
+
+session_id("abtest");
+session_start();
+session_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;}}');
+
+$_SESSION["baz"]->method();
+$_SESSION["arr"][3]->method();
+
+var_dump($_SESSION["baz"]);
+var_dump($_SESSION["arr"]);
+session_destroy();
+--EXPECT--
+object(foo)#1 (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+}
+array(1) {
+ [3]=>
+ object(foo)#2 (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+ }
+}
+