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
Inverse of #9566 (scalar subject vs enum arm). When the match subject is an enum case object, arms labeled with backing scalars must not match via coercion.
Category
language· php-src-strictProblem
Inverse of #9566 (scalar subject vs enum arm). When the
matchsubject is an enum case object, arms labeled with backing scalars must not match via coercion.Zend uses strict identity;
match (F::X) { 1 => 'int_hit', F::X => 'case_hit' }returnscase_hit.This compiler coerces the subject to
intand returnsint_hit.php-src reference
Zend/zend_execute.c—zend_match()Zend/zend_enum.c— enum object identity===with scalars, Language: match() scalar subject must not match enum-case arms via backing coercion (Zend/zend_execute.c) #9566 scalar subjectRepro (failure today)
case_hitint_hitScope
lib/VM.php—matcharm comparison (strict, no enum backing coercion)lib/JIT/—matchlowering shares compare helper with php-in-php: JIT SpaceshipCompareJit — route <=> through CompareJitHelper PHP not ~1.2k-line LLVM (#1492) #9476 SpaceshipCompareJit / enum guardstest/compliance/cases/language/match_enum_subject_scalar_arm.phptDone when
case_hiton VM./script/ci-fast.sh --filter match_enum_subjectgreenRelated