File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
tests/constants/final_constants Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ PHP NEWS
11
11
on final or abstract interface methods). (ilutov)
12
12
. Fixed bug #81585 (cached_chunks are not counted to real_size on shutdown).
13
13
(cmb)
14
+ . Fixed bug GH-7757 (Multi-inherited final constant causes fatal error).
15
+ (cmb)
14
16
15
17
- Hash:
16
18
. Fixed bug GH-7759 (Incorrect return types for hash() and hash_hmac()).
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug GH-7757 (Multi-inherited final constant causes fatal error)
3
+ --FILE--
4
+ <?php
5
+ interface EntityInterface {
6
+ final public const TEST = 'this ' ;
7
+ }
8
+
9
+ interface KeyInterface extends EntityInterface {
10
+ }
11
+
12
+ interface StringableInterface extends EntityInterface {
13
+ }
14
+
15
+ class SomeTestClass implements KeyInterface, StringableInterface {
16
+ }
17
+ ?>
18
+ --EXPECT--
Original file line number Diff line number Diff line change @@ -1605,7 +1605,7 @@ static bool do_inherit_constant_check(
1605
1605
}
1606
1606
1607
1607
zend_class_constant * old_constant = Z_PTR_P (zv );
1608
- if ((ZEND_CLASS_CONST_FLAGS (parent_constant ) & ZEND_ACC_FINAL )) {
1608
+ if (parent_constant -> ce != old_constant -> ce && (ZEND_CLASS_CONST_FLAGS (parent_constant ) & ZEND_ACC_FINAL )) {
1609
1609
zend_error_noreturn (E_COMPILE_ERROR , "%s::%s cannot override final constant %s::%s" ,
1610
1610
ZSTR_VAL (old_constant -> ce -> name ), ZSTR_VAL (name ),
1611
1611
ZSTR_VAL (parent_constant -> ce -> name ), ZSTR_VAL (name )
You can’t perform that action at this time.
0 commit comments