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
{{ message }}
Repository navigation
Language: array-literal enum case keys TypeError still "Illegal offset type" — Zend "Cannot access offset of type E" (Zend/zend_hash.c) #28628
Assignment $a[$enum] = … already emits Zend’s typed message (Cannot access offset of type E on array). Array literals[E::A => 1] still throw the legacy Illegal offset type string under VM/JIT PROFILE=8.4.
Re-verified 2026-08-07 @ 823e740094 vs php:8.4-cli 8.4.24.
Repro
Zend 8.4.24
VM/JIT PROFILE=8.4
$a=[]; $a[E::A]=1; (unit enum)
Cannot access offset of type E on array
same (OK)
$arr = [E::A => 1];
Cannot access offset of type E on array
Illegal offset type
$arr = [S::A => 1]; (string-backed)
Cannot access offset of type S on array
Illegal offset type
Related history (#9512 / #16986) fixed acceptance of enum keys; this issue is message parity on the literal path only.
Array-literal key store in lib/ / VM init-array lowering — reuse the same TypeError formatter the assignment path already uses (Cannot access offset of type %s on array)
Merged — array-literal enum keys now throw Zend-shaped Cannot access offset of type <Enum> on array under PROFILE≥8.3 (same as assignment).
Cause: INIT_ARRAY threw bare Illegal offset type for TYPE_OBJECT before rejectIllegalArrayOffset. Fix: reuse shared typed formatter; JIT literal/addElement path matches.
Verification: issue repro VM+JIT typed messages; PROFILE=8.2 still legacy; EnumCaseTypeNameTest OK.
Activity
PurHur commentedon Aug 7, 2026
Inline repro (if
test/repro/maintainer_enum_array_literal_key_msg.phpis not on the branch yet)Expect Zend:
TypeError:Cannot access offset of type E on arrayPurHur commentedon Aug 7, 2026
claim: Worker lane C — starting this run
Language: array-literal enum keys use typed TypeError (#28628) (#28735)
PurHur commentedon Aug 7, 2026
Merged — array-literal enum keys now throw Zend-shaped
Cannot access offset of type <Enum> on arrayunder PROFILE≥8.3 (same as assignment).Cause: INIT_ARRAY threw bare
Illegal offset typefor TYPE_OBJECT beforerejectIllegalArrayOffset.Fix: reuse shared typed formatter; JIT literal/
addElementpath matches.Verification: issue repro VM+JIT typed messages; PROFILE=8.2 still legacy;
EnumCaseTypeNameTestOK.PR: #28735
PurHur commentedon Aug 7, 2026
Closed via squash-merge of #28735.