Repository navigation
Stdlib: iterator_to_array(null) always TypeError (#21893) - #21909
Merged
PurHur merged 1 commit intoJul 21, 2026
Merged
Conversation
Typed Traversable|array rejects null without InternalStrictArg / soft-empty coercion (php-src ext/spl). Drop iterator_to_array from the #21771 soft-null batch; guard with compliance + repro (VM/JIT). Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iterator_to_array(null)always throws Zend-identicalTypeError(typedTraversable|array) on VM + JIT — noInternalStrictArg/ soft-empty / deprecation path (ext/spl, php-src-strict).iterator_to_arrayfrom the Regression: count()/array_merge()/array_keys()/in_array() null TypeError under PROFILE=8.4 — Zend DEP+coerce (ext/standard) #21771 PROFILE=8.4 soft-null batch (that coerce was wrong for this builtin)..phpt(VM + JIT) + repro undertest/repro/.php-src:
ext/spl/spl.stub.php,ext/spl/iterator.c—PHP_FUNCTION(iterator_to_array).PHP impl:
ext/standard/iterator_to_array.php(VM viaVM::iteratorToArray→VmIteratorWalk::assertTraversable; JIT null viaJitIterableArg::emitIterableTypeErrorAndAbort).Closes #21893
Test plan
iterator_to_array_null_typeerror|array_null_soft_forward84iterator_to_array(null)compiles and hits TypeError abort path (same asiterator_count(null)AOT)Verification
Pillar 1 note (pre-existing)
make bootstrap-selfhost-linkred on this host:SuperglobalRefreshJitHelper::buildGetTable()TypeError (#21888 / open PR #21904) — unrelated to this stdlib change.Made with Cursor