You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
array_map() and array_filter() must pass enum case objects through to callbacks and return arrays whose elements remain enum cases when the callback returns them unchanged. This compiler unwraps enum cases to backing scalars (int/string) during iteration, so identity callbacks produce numeric arrays.
Category
stdlibProblem
array_map()andarray_filter()must pass enum case objects through to callbacks and return arrays whose elements remain enum cases when the callback returns them unchanged. This compiler unwraps enum cases to backing scalars (int/string) during iteration, so identity callbacks produce numeric arrays.php-src reference
ext/standard/array.c—PHP_FUNCTION(array_map),PHP_FUNCTION(array_filter)Zend/zend_enum.c— enum case object zvalsRepro (verified 2026-06-04)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && cd /compiler && php repro.php && php bin/vm.php repro.php'array_map(fn($x)=>$x, …)array(0=>\E::A, 1=>\E::B)array(0=>1, 1=>2)array_filter(…, fn…)array(0=>\E::A)array(0=>1)Scope (this repo)
ext/standard/array_map.php,array_filter.php,VmArray.php/ iterator helperslib/JIT/ArrayBuiltinHelper.php— enum-aware element copytest/compliance/cases/stdlib/array_map_enum_identity.phpt,array_filter_enum.phptDistinct from #5547 (
array_values/array_merge) and #5546 (sortfamily) — those are separate builtins with the same root scalarization bug.Done when
bin/vm.php$x === E::Astrict works inside closure)./script/ci-fast.sh --filter array_map_enumgreenRelated
array_filterthird$modeargumentarray_mapnull zip