Stdlib: iterator_to_array(null $preserve_keys) TypeError under strict_types (#31340) - #31376
Merged
PurHur merged 1 commit intoAug 16, 2026
Merged
Conversation
…_types (#31340) Route Z_PARAM_BOOL $preserve_keys through parseBoolBuiltinArgForFrame / lowerCoerceZParamBool so caller strict_types TypeErrors match Zend; soft-null keeps DEP+coerce to false. AOT early-return after compile-time null abort. Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur
deleted the
agent/issue-31340-iterator-to-array-preserve-keys-null
branch
August 16, 2026 09:17
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)$preserve_keysunderdeclare(strict_types=1)to match Zend/php-srcZ_PARAM_BOOL(TypeErrorinstead of coercing viatoBool()).E_DEPRECATEDand coerces tofalsevia sharedparseBoolBuiltinArgForFrame/JitBoolArg::lowerCoerceZParamBool.preserve_keys=true.Closes #31340
php-src:
ext/spl/iterator.c/ext/spl/spl.stub.phpTest plan
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/issue_31340_iterator_to_array_null_preserve_keys.php'./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php test/repro/…'./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/compile.php -o /tmp/ita31340 test/repro/… && /tmp/ita31340'./script/phpunit.sh --filter IteratorToArrayNullPreserveKeysStrict31340(VM + JIT + soft DEP)./script/phpunit.sh --filter iterator_to_array_null_preserve_keys_strict --group aotVerification transcript
Made with Cursor