summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug70730.phpt
blob: 5710c9586de858693d211c34cc75aee93cbffee1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--TEST--
Bug #70730 (Incorrect ArrayObject serialization if unset is called in serialize())
--FILE--
<?php
class A extends \ArrayObject
{
	protected $foo;

	public function __construct()
	{
		$this->foo = 'bar';
	}

	public function serialize()
	{
		unset($this->foo);
		$result = parent::serialize();
		$this->foo = 'bar';
		return $result;
	}
}

$a = new A();
$a->append('item1');
$a->append('item2');
$a->append('item3');
$b = new A();
$b->unserialize($a->serialize());
var_dump($b);
?>
--EXPECTF--
object(A)#%d (2) {
  ["foo":protected]=>
  string(3) "bar"
  ["storage":"ArrayObject":private]=>
  array(3) {
    [0]=>
    string(5) "item1"
    [1]=>
    string(5) "item2"
    [2]=>
    string(5) "item3"
  }
}