blob: 1ce6cae4ade780c30bc5d4b9c526c8afb3f53b5f (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
--TEST--
SPL: ArrayObject/Iterator and reference to self
--FILE--
==ArrayObject===
<?php
class MyArrayObject extends ArrayObject
{
public function __construct()
{
parent::__construct($this);
$this['bar'] = 'baz';
}
}
$a = new MyArrayObject;
$b = clone $a;
$b['baz'] = 'Foo';
var_dump($a);
var_dump($b);
?>
==ArrayIterator===
<?php
class MyArrayIterator extends ArrayIterator
{
public function __construct()
{
parent::__construct($this);
$this['bar'] = 'baz';
}
}
$a = new MyArrayIterator;
$b = clone $a;
$b['baz'] = 'Foo';
var_dump($a);
var_dump($b);
?>
===DONE===
--EXPECTF--
==ArrayObject===
object(MyArrayObject)#%d (1) {
["bar"]=>
string(3) "baz"
}
object(MyArrayObject)#%d (2) {
["bar"]=>
string(3) "baz"
["baz"]=>
string(3) "Foo"
}
==ArrayIterator===
object(MyArrayIterator)#%d (1) {
["bar"]=>
string(3) "baz"
}
object(MyArrayIterator)#%d (2) {
["bar"]=>
string(3) "baz"
["baz"]=>
string(3) "Foo"
}
===DONE===
|