bug70959.phpt 487 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #70959 (ArrayObject unserialize does not restore protected fields)
  3. --FILE--
  4. <?php
  5. class testObject extends ArrayObject {
  6. protected $test;
  7. public function getTest() {
  8. return $this->test;
  9. }
  10. public function setTest($test) {
  11. $this->test = $test;
  12. }
  13. }
  14. $obj = new testObject();
  15. $obj->setTest('test');
  16. var_dump($obj->getTest());
  17. $obj2 = unserialize(serialize($obj));
  18. var_dump($obj2->getTest());
  19. ?>
  20. --EXPECT--
  21. string(4) "test"
  22. string(4) "test"