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_reduce() with an int-backed enum case array and a callback that adds integers must TypeError when Zend cannot coerce enum objects to int in the reducer. This compiler coerces enum cases to backing ints and returns a sum.
Distinct from #5626 (callback must receive enum objects); this issue is the TypeError when reducer performs illegal scalar arithmetic on enum cases.
Category
stdlib| php-src-strictProblem
array_reduce()with an int-backed enum case array and a callback that adds integers must TypeError when Zend cannot coerce enum objects to int in the reducer. This compiler coerces enum cases to backing ints and returns a sum.Distinct from #5626 (callback must receive enum objects); this issue is the TypeError when reducer performs illegal scalar arithmetic on enum cases.
php-src reference
ext/standard/array.c—PHP_FUNCTION(array_reduce)Zend/zend_operators.c—add_functionon enum zvals → TypeErrorRepro
te(TypeError on enum + int)3Scope
ext/standard/array_reduce.php, enum-aware reducer inlib/VM/test/compliance/cases/stdlib/array_reduce_enum_type_error.phptDone when
teon VM under php-src-strict./script/ci-fast.sh --filter array_reduce_enumgreenRelated