1--TEST--
2SPL: ArrayObject with bad iterator class.
3--FILE--
4<?php
5try {
6  $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3));
7  $ao->setIteratorClass("nonExistentClass");
8  foreach($ao as $key=>$value) {
9    echo "  $key=>$value\n";
10  }
11} catch (Exception $e) {
12	var_dump($e->getMessage());
13}
14
15try {
16  $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3));
17  $ao->setIteratorClass("stdClass");
18  foreach($ao as $key=>$value) {
19    echo "  $key=>$value\n";
20  }
21} catch (Exception $e) {
22	var_dump($e->getMessage());
23}
24
25
26try {
27  $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "nonExistentClass");
28  foreach($ao as $key=>$value) {
29    echo "  $key=>$value\n";
30  }
31} catch (TypeError $e) {
32	var_dump($e->getMessage());
33}
34
35try {
36  $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "stdClass");
37  foreach($ao as $key=>$value) {
38    echo "  $key=>$value\n";
39  }
40} catch (TypeError $e) {
41	var_dump($e->getMessage());
42}
43
44?>
45--EXPECTF--
46Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from ArrayIterator, 'nonExistentClass' given in %s on line %d
47  a=>1
48  b=>2
49  c=>3
50
51Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from ArrayIterator, 'stdClass' given in %s on line %d
52  a=>1
53  b=>2
54  c=>3
55string(118) "ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, 'nonExistentClass' given"
56string(110) "ArrayObject::__construct() expects parameter 3 to be a class name derived from ArrayIterator, 'stdClass' given"
57