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 (TypeError $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 (TypeError $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--EXPECT--
46string(133) "ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClass given"
47string(125) "ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, stdClass given"
48string(128) "ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClass given"
49string(120) "ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, stdClass given"
50