xref: /PHP-8.0/ext/spl/tests/bug70959.phpt (revision 7aacc705)
1--TEST--
2Bug #70959 (ArrayObject unserialize does not restore protected fields)
3--FILE--
4<?php
5class testObject extends ArrayObject {
6    protected $test;
7
8    public function getTest() {
9        return $this->test;
10    }
11
12    public function setTest($test) {
13        $this->test = $test;
14    }
15}
16
17$obj = new testObject();
18$obj->setTest('test');
19var_dump($obj->getTest());
20$obj2 = unserialize(serialize($obj));
21var_dump($obj2->getTest());
22?>
23--EXPECT--
24string(4) "test"
25string(4) "test"
26