mirror of
https://github.com/php/php-src.git
synced 2026-10-29 02:07:35 +08:00
Splitting the behavioural change of #23052 out into this and come up with something that is hopefully more sensible and consistent between fast and slow ZPP and the object or class_name Fast ZPP specifier.
26 lines
778 B
PHP
26 lines
778 B
PHP
--TEST--
|
|
SPL: ArrayObject::__construct with bad iterator.
|
|
--FILE--
|
|
<?php
|
|
echo "Bad iterator type:\n";
|
|
$a = new stdClass;
|
|
$a->p = 1;
|
|
try {
|
|
var_dump(new ArrayObject($a, 0, "Exception"));
|
|
} catch (TypeError $e) {
|
|
echo $e::class, ': ', $e->getMessage(), "\n";
|
|
}
|
|
|
|
echo "Non-existent class:\n";
|
|
try {
|
|
var_dump(new ArrayObject(new stdClass, 0, "nonExistentClassName"));
|
|
} catch (TypeError $e) {
|
|
echo $e::class, ': ', $e->getMessage(), "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
Bad iterator type:
|
|
TypeError: ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, "Exception" given
|
|
Non-existent class:
|
|
TypeError: ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, "nonExistentClassName" given
|