Skip to content

Stdlib: array_slice/chunk/reverse null preserve_keys DEP+coerce (#31442) - #31454

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-31442-array-preserve-keys-null
Aug 16, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/stdlib-31442-array-preserve-keys-null

Conversation

@PurHur

@PurHur PurHur commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

php-src: ext/standard/array.c (PHP_FUNCTION(array_slice|array_chunk|array_reverse)), stub bool $preserve_keys = false.

Test plan

  • ./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_array_preserve_keys_null.php'
  • ./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/issue_31442_array_preserve_keys_null_strict.php'
  • ./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_array_preserve_keys_null.php'
  • ./script/phpunit.sh --filter 'ArrayPreserveKeysNull31442|array_preserve_keys_null' → OK (6 tests)
  • AOT soft/strict: php bin/compile.php -o … test/repro/issue_31442_array_preserve_keys_null_aot{,_strict}.php (slice+chunk; reverse AOT IR verify is pre-existing)

Closes #31442

Made with Cursor

Match php-src Z_PARAM_BOOL under non-strict (E_DEPRECATED + false); keep TypeError under strict_types. Reuses parseBoolBuiltinArgForFrame / JitBoolArg::lowerCoerceZParamBool like iterator_to_array (#31340).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 015ed8c into master Aug 16, 2026
1 check failed
@PurHur
PurHur deleted the agent/stdlib-31442-array-preserve-keys-null branch August 16, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: array_slice/chunk/reverse(..., null) preserve_keys TypeError — Zend E_DEPRECATED (re-#24693, ext/standard/array.c)

1 participant