1--TEST--
2SPL: ArrayObject::count() and ArrayIterator::count() basic functionality.
3--FILE--
4==ArrayObject==
5<?php
6class C extends ArrayObject {
7  function count() {
8    return 99;
9  }
10}
11
12$c = new C;
13$ao = new ArrayObject;
14
15var_dump(count($c), count($ao));
16
17$c[] = 'a';
18$ao[] = 'a';
19var_dump(count($c), count($ao));
20
21$c[] = 'b';
22$ao[] = 'b';
23var_dump(count($c), count($ao));
24
25unset($c[0]);
26unset($ao[0]);
27var_dump($c->count(), $ao->count());
28
29//Extra args are ignored.
30var_dump($ao->count('blah'));
31?>
32==ArrayIterator==
33<?php
34class D extends ArrayIterator {
35  function count() {
36    return 99;
37  }
38}
39
40$c = new D;
41$ao = new ArrayIterator;
42
43var_dump(count($c), count($ao));
44
45$c[] = 'a';
46$ao[] = 'a';
47var_dump(count($c), count($ao));
48
49$c[] = 'b';
50$ao[] = 'b';
51var_dump(count($c), count($ao));
52
53unset($c[0]);
54unset($ao[0]);
55var_dump($c->count(), $ao->count());
56
57//Extra args are ignored.
58var_dump($ao->count('blah'));
59?>
60--EXPECTF--
61==ArrayObject==
62int(99)
63int(0)
64int(99)
65int(1)
66int(99)
67int(2)
68int(99)
69int(1)
70
71Warning: ArrayObject::count() expects exactly 0 parameters, 1 given in %s on line %d
72NULL
73==ArrayIterator==
74int(99)
75int(0)
76int(99)
77int(1)
78int(99)
79int(2)
80int(99)
81int(1)
82
83Warning: ArrayIterator::count() expects exactly 0 parameters, 1 given in %s on line %d
84NULL
85