Category
Regression: · php-src-strict · SPL iterator null-inner TypeError message
Problem
Passing null where an Iterator is required throws on both engines, but VM attributes the TypeError to IteratorIterator::__construct with type Traversable. Zend cites the concrete method (AppendIterator::append, LimitIterator::__construct, CachingIterator::__construct) and type Iterator.
Same message-attribution class as open #31509 (SplObjectStorage::offsetSet citing attach).
Probed 2026-08-16 — host Zend PHP 8.2.32 vs php bin/vm.php.
| Repro |
Zend 8.2+ |
VM (2026-08-16) |
(new AppendIterator())->append(null) |
TypeError: AppendIterator::append(): Argument #1 ($iterator) must be of type Iterator, null given |
TypeError: IteratorIterator::__construct(): Argument #1 ($iterator) must be of type Traversable, null given |
new LimitIterator(null) |
LimitIterator::__construct(): … Iterator, null given |
IteratorIterator::__construct(): … Traversable, null given |
new CachingIterator(null) |
CachingIterator::__construct(): … Iterator, null given |
IteratorIterator::__construct(): … Traversable, null given |
Also affects siblings that share the same parent check (NoRewindIterator, InfiniteIterator, MultipleIterator::attachIterator, RecursiveIteratorIterator) — fix the shared guard once.
php-src reference
PHP implementation target
ext/spl/ iterator builtins — type-check with Zend receiver method name + Iterator (not parent IteratorIterator / Traversable)
- Prefer shared PHP guard used by Append/Limit/Caching/NoRewind/Infinite/Multiple/RII
- No new
runtime/*.c
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_spl_iterator_null_inner_message.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_spl_iterator_null_inner_message.php'
Done when
Category
Regression:· php-src-strict · SPL iterator null-inner TypeError messageProblem
Passing
nullwhere anIteratoris required throws on both engines, but VM attributes theTypeErrortoIteratorIterator::__constructwith typeTraversable. Zend cites the concrete method (AppendIterator::append,LimitIterator::__construct,CachingIterator::__construct) and typeIterator.Same message-attribution class as open #31509 (
SplObjectStorage::offsetSetcitingattach).Probed 2026-08-16 — host Zend PHP 8.2.32 vs
php bin/vm.php.(new AppendIterator())->append(null)TypeError: AppendIterator::append(): Argument #1 ($iterator) must be of type Iterator, null givenTypeError: IteratorIterator::__construct(): Argument #1 ($iterator) must be of type Traversable, null givennew LimitIterator(null)LimitIterator::__construct(): … Iterator, null givenIteratorIterator::__construct(): … Traversable, null givennew CachingIterator(null)CachingIterator::__construct(): … Iterator, null givenIteratorIterator::__construct(): … Traversable, null givenAlso affects siblings that share the same parent check (
NoRewindIterator,InfiniteIterator,MultipleIterator::attachIterator,RecursiveIteratorIterator) — fix the shared guard once.php-src reference
ext/spl/spl_iterators.c—Z_PARAM_OBJ_OF_CLASS/ typedIteratoron append/ctorsext/spl/spl_iterators.stub.phpPHP implementation target
ext/spl/iterator builtins — type-check with Zend receiver method name +Iterator(not parentIteratorIterator/Traversable)runtime/*.cRepro
Done when
Iteratorfor Append/Limit/Caching (and listed siblings)