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: final class constants (final const) — parse + override rules (zend_compile.c parity) #4455
PHP 8.1+ allows final const on classes/interfaces/traits/enums. Child classes cannot redefine or override a final const; Zend emits a compile-time error.
This compiler accepts ordinary const on classes (#2199) but does not model final on class constants — php-parser/php-cfg may parse the modifier without enforcing Zend inheritance rules.
php-src reference
Zend/zend_compile.c — zend_compile_const_decl, ZEND_ACC_CONSTANT + final bit
Activity
PurHur commentedon Jun 2, 2026
claim: cursor-worker-lane-c — starting this run
Fix final class constant override at compile time (#4455) (#4498)
PurHur commentedon Jun 2, 2026
Merged via #4498
Verification:
Child::X cannot override final constant Base::Xat compile time (issue repro +FinalClassConstCheckTest+VMTest --filter final_class_const). Non-final constants remain overridable (final_class_const_override_ok.phpt).php-src:
Zend/zend_compile.c,Zend/zend_inheritance.cLanguage: reject eval override of final class constants (#22329) (#22342
Trust: extract InheritanceFinalVarianceAndConstFetch from VM.php (#36403
Trust: extract InheritanceFinalVarianceAndConstFetch from VM.php (#36403