php-src/ext/spl/tests/iterator_count.phpt
Nikita Popov 440481fb3e Display TypeExceptions like normal exceptions
We currently don't show the argument at which the error actually
occured in the trace - should probably either add it or don't
display args on incomplete frames altogether, otherwise this'll
probably be confusing.
2015-05-17 19:54:12 +02:00

31 lines
647 B
PHP

--TEST--
SPL: iterator_count() exceptions test
--CREDITS--
Lance Kesson jac_kesson@hotmail.com
#testfest London 2009-05-09
--FILE--
<?php
$array=array('a','b');
$iterator = new ArrayIterator($array);
iterator_count();
iterator_count($iterator,'1');
iterator_count('1');
?>
--EXPECTF--
Warning: iterator_count() expects exactly 1 parameter, 0 given in %s
Warning: iterator_count() expects exactly 1 parameter, 2 given in %s
Fatal error: Uncaught TypeException: Argument 1 passed to iterator_count() must implement interface Traversable, string given in %s:%d
Stack trace:
#0 %s(%d): iterator_count('1')
#1 {main}
thrown in %s on line %d