diff --git a/ext/spl/tests/spl_iterator_apply_with_trampoline.phpt b/ext/spl/tests/spl_iterator_apply_with_trampoline.phpt new file mode 100644 index 00000000000..7247506b85b --- /dev/null +++ b/ext/spl/tests/spl_iterator_apply_with_trampoline.phpt @@ -0,0 +1,48 @@ +--TEST-- +SPL: iterator_apply() with a trampoline +--FILE-- +getMessage(), PHP_EOL; +} +try { + iterator_apply($it, $callbackThrow); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +try { + iterator_apply($it, $callback, 'not an array'); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} + +?> +--EXPECT-- +Trampoline for trampoline +array(0) { +} +int(1) +Trampoline for trampolineThrow +array(0) { +} +Exception: boo +TypeError: iterator_apply(): Argument #3 ($args) must be of type ?array, string given