Annotation of embedaddon/php/ext/spl/tests/array_015.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: ArrayIterator::next() with internal arrays
3: --FILE--
4: <?php
5:
6: $ar = new ArrayObject();
7:
8: $ar[0] = 1;
9: $ar[1] = 2;
10: $ar[2] = 3;
11: $ar[3] = 4;
12: $ar[4] = 5;
13:
14: var_dump($ar);
15:
16: $it = $ar->getIterator();
17:
18: $ar->offsetUnset($it->key());
19: $it->next();
20:
21: var_dump($it->current());
22: var_dump($ar);
23:
24: foreach($it as $k => $v)
25: {
26: $ar->offsetUnset($k+1);
27: echo "$k=>$v\n";
28: }
29:
30: var_dump($ar);
31:
32: foreach($it as $k => $v)
33: {
34: $ar->offsetUnset($k);
35: echo "$k=>$v\n";
36: }
37:
38: var_dump($ar);
39:
40: ?>
41: ===DONE===
42: <?php exit(0); ?>
43: --EXPECTF--
44: object(ArrayObject)#%d (1) {
45: %s"storage"%s"ArrayObject":private]=>
46: array(5) {
47: [0]=>
48: int(1)
49: [1]=>
50: int(2)
51: [2]=>
52: int(3)
53: [3]=>
54: int(4)
55: [4]=>
56: int(5)
57: }
58: }
59:
60: Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
61: int(2)
62: object(ArrayObject)#%d (1) {
63: %s"storage"%s"ArrayObject":private]=>
64: array(4) {
65: [1]=>
66: int(2)
67: [2]=>
68: int(3)
69: [3]=>
70: int(4)
71: [4]=>
72: int(5)
73: }
74: }
75: 1=>2
76: 3=>4
77: object(ArrayObject)#%d (1) {
78: %s"storage"%s"ArrayObject":private]=>
79: array(2) {
80: [1]=>
81: int(2)
82: [3]=>
83: int(4)
84: }
85: }
86: 1=>2
87:
88: Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
89: 3=>4
90:
91: Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_015.php on line %d
92: object(ArrayObject)#%d (1) {
93: %s"storage"%s"ArrayObject":private]=>
94: array(0) {
95: }
96: }
97: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>