summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-02-21 13:01:28 +0100
committerNikita Popov <nikic@php.net>2016-02-21 13:01:28 +0100
commit37d1bbe456cb3995bfc831680c3e3439124864ec (patch)
tree3f69710bccc2be4aaf786a9485c44e46f43e089e /ext/spl
parent7a15656b5c3bc04d83c9da05419da8318a15abad (diff)
parent0bd64b50b88d243cf337e0c5dbea20e4ba809117 (diff)
downloadphp-git-37d1bbe456cb3995bfc831680c3e3439124864ec.tar.gz
Merge branch 'PHP-7.0'
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/tests/bug71617.phpt50
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/spl/tests/bug71617.phpt b/ext/spl/tests/bug71617.phpt
new file mode 100644
index 0000000000..412f83f541
--- /dev/null
+++ b/ext/spl/tests/bug71617.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #71617: private properties lost when unserializing ArrayObject
+--FILE--
+<?php
+
+class Test extends ArrayObject
+{
+
+ private $name = null;
+
+ public function __construct(array $input)
+ {
+ parent::__construct($input, ArrayObject::ARRAY_AS_PROPS);
+ }
+
+ public function setName($name)
+ {
+ $this->name = $name;
+ return $this;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+}
+
+$test = new Test(['a' => 'a', 'b' => 'b']);
+$test->setName('ok');
+
+$ser = serialize($test);
+$unSer = unserialize($ser);
+
+var_dump($unSer->getName());
+var_dump($unSer);
+
+?>
+--EXPECT--
+string(2) "ok"
+object(Test)#2 (2) {
+ ["name":"Test":private]=>
+ string(2) "ok"
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ ["a"]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "b"
+ }
+}