summaryrefslogtreecommitdiff
path: root/ext/spl/tests/iterator_048.phpt
blob: bad4e7888a78ae96558dd5aed46d8172e34c9900 (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
--TEST--
SPL: RecursiveRegexIterator and exception in has/getChildren
--FILE--
<?php

class MyRecursiveRegexIterator extends RecursiveRegexIterator
{
	function show()
	{
		foreach(new RecursiveIteratorIterator($this) as $k => $v)
		{
			var_dump($k);
			var_dump($v);
		}
	}

	function accept()
	{
		return $this->hasChildren() || parent::accept();
	}
}

$ar = new RecursiveArrayIterator(array('Foo', array('Bar'), 'FooBar', array('Baz'), 'Biz'));
$it = new MyRecursiveRegexIterator($ar, '/Bar/');

$it->show();

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
int(0)
string(3) "Bar"
int(2)
string(6) "FooBar"
===DONE===