xref: /PHP-7.0/ext/spl/tests/bug36941.phpt (revision 610c7fbe)
1--TEST--
2Bug #36941 (ArrayIterator does not clone itself)
3--FILE--
4===ArrayObject===
5<?php
6$a = new ArrayObject();
7$a[] = 1;
8
9$b = clone $a;
10
11var_dump($a[0], $b[0]);
12$b[0] = $b[0] + 1;
13var_dump($a[0], $b[0]);
14$b[0] = 3;
15var_dump($a[0], $b[0]);
16?>
17===ArrayIterator===
18<?php
19$a = new ArrayIterator();
20$a[] = 1;
21
22$b = clone $a;
23
24var_dump($a[0], $b[0]);
25$b[0] = $b[0] + 1;
26var_dump($a[0], $b[0]);
27$b[0] = 3;
28var_dump($a[0], $b[0]);
29?>
30===DONE===
31--EXPECT--
32===ArrayObject===
33int(1)
34int(1)
35int(1)
36int(2)
37int(1)
38int(3)
39===ArrayIterator===
40int(1)
41int(1)
42int(2)
43int(2)
44int(3)
45int(3)
46===DONE===
47