1--TEST-- 2Testing class extending to ArrayObject and serialize 3--FILE-- 4<?php 5 6class Name extends ArrayObject 7{ 8 public $var = 'a'; 9 protected $bar = 'b'; 10 private $foo = 'c'; 11} 12 13$a = new Name(); 14var_dump($a); 15var_dump($a->var); 16 17$a = unserialize(serialize($a)); 18 19var_dump($a); 20var_dump($a->var); 21 22class Bla extends ArrayObject 23{ 24 public $var = 'aaa'; 25 protected $bar = 'bbb'; 26 private $foo = 'ccc'; 27} 28 29$a = new Bla(); 30var_dump($a); 31var_dump($a->var); 32 33$a = unserialize(serialize($a)); 34 35var_dump($a); 36var_dump($a->var); 37 38?> 39--EXPECT-- 40object(Name)#1 (4) { 41 ["var"]=> 42 string(1) "a" 43 ["bar":protected]=> 44 string(1) "b" 45 ["foo":"Name":private]=> 46 string(1) "c" 47 ["storage":"ArrayObject":private]=> 48 array(0) { 49 } 50} 51string(1) "a" 52object(Name)#2 (4) { 53 ["var"]=> 54 string(1) "a" 55 ["bar":protected]=> 56 string(1) "b" 57 ["foo":"Name":private]=> 58 string(1) "c" 59 ["storage":"ArrayObject":private]=> 60 array(0) { 61 } 62} 63string(1) "a" 64object(Bla)#1 (4) { 65 ["var"]=> 66 string(3) "aaa" 67 ["bar":protected]=> 68 string(3) "bbb" 69 ["foo":"Bla":private]=> 70 string(3) "ccc" 71 ["storage":"ArrayObject":private]=> 72 array(0) { 73 } 74} 75string(3) "aaa" 76object(Bla)#2 (4) { 77 ["var"]=> 78 string(3) "aaa" 79 ["bar":protected]=> 80 string(3) "bbb" 81 ["foo":"Bla":private]=> 82 string(3) "ccc" 83 ["storage":"ArrayObject":private]=> 84 array(0) { 85 } 86} 87string(3) "aaa" 88