Skip to content

Stdlib: guard array_map/array_filter enum identity parity (#5564) - #18399

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-5564-array-map-filter-enum
Jul 12, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-5564-array-map-filter-enum

Conversation

@PurHur

@PurHur PurHur commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Root cause

Fixed upstream in enum-aware array iteration / callback paths; issue was open without regression tests.

Verification

# Issue repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && cd /compiler && php test/repro/array_map_filter_enum_identity.php && php bin/vm.php test/repro/array_map_filter_enum_identity.php && php bin/jit.php test/repro/array_map_filter_enum_identity.php'

# Targeted PHPUnit
./script/phpunit.sh --filter 'array_map_enum|array_filter_enum'

Output (2026-07-12):

array (
  0 => \E::A,
  1 => \E::B,
)
array (
  0 => \E::A,
)

(VM + JIT identical to Zend)

PHPUnit: OK (5 tests, 5 assertions)

Made with Cursor

Behavior already matches Zend on master; add compliance PHPTs and repro
so enum case objects stay objects through map/filter callbacks.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit a2f6194 into master Jul 12, 2026
@PurHur
PurHur deleted the agent/issue-5564-array-map-filter-enum branch July 12, 2026 22:53
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.

Stdlib: array_map()/array_filter() on enum arrays must preserve enum case objects (ext/standard/array.c)

1 participant