mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix GH-7757: Multi-inherited final constant causes fatal error
This commit is contained in:
commit
dd6b1b7ef7
2 changed files with 19 additions and 1 deletions
18
Zend/tests/constants/final_constants/final_const13.phpt
Normal file
18
Zend/tests/constants/final_constants/final_const13.phpt
Normal file
|
@ -0,0 +1,18 @@
|
|||
--TEST--
|
||||
Bug GH-7757 (Multi-inherited final constant causes fatal error)
|
||||
--FILE--
|
||||
<?php
|
||||
interface EntityInterface {
|
||||
final public const TEST = 'this';
|
||||
}
|
||||
|
||||
interface KeyInterface extends EntityInterface {
|
||||
}
|
||||
|
||||
interface StringableInterface extends EntityInterface {
|
||||
}
|
||||
|
||||
class SomeTestClass implements KeyInterface, StringableInterface {
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue