Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix GH-7757: Multi-inherited final constant causes fatal error
This commit is contained in:
Christoph M. Becker 2021-12-12 22:23:07 +01:00
commit dd6b1b7ef7
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
2 changed files with 19 additions and 1 deletions

View file

@ -1601,7 +1601,7 @@ static bool do_inherit_constant_check(
}
zend_class_constant *old_constant = Z_PTR_P(zv);
if ((ZEND_CLASS_CONST_FLAGS(parent_constant) & ZEND_ACC_FINAL)) {
if (parent_constant->ce != old_constant->ce && (ZEND_CLASS_CONST_FLAGS(parent_constant) & ZEND_ACC_FINAL)) {
zend_error_noreturn(E_COMPILE_ERROR, "%s::%s cannot override final constant %s::%s",
ZSTR_VAL(old_constant->ce->name), ZSTR_VAL(name),
ZSTR_VAL(parent_constant->ce->name), ZSTR_VAL(name)