xref: /PHP-7.1/ext/spl/tests/iterator_036.phpt (revision 113213f0)
1--TEST--
2SPL: CachingIterator and __toString and flags = 0
3--FILE--
4<?php
5
6function test($it)
7{
8	foreach($it as $v)
9	{
10		var_dump((string)$it);
11	}
12}
13
14$ar = new ArrayIterator(array(1, 2, 3));
15
16test(new CachingIterator($ar, 0));
17
18?>
19===DONE===
20--EXPECTF--
21Fatal error: Method CachingIterator::__toString() must not throw an exception, caught BadMethodCallException: CachingIterator does not fetch string value (see CachingIterator::__construct) in %siterator_036.php on line %d
22