Skip to content

Commit 1d353f8

Browse files
committed
#17725 fix checking inheritance while replacing static with self in final classes
1 parent baa7b49 commit 1d353f8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Zend/zend_inheritance.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,15 @@ static inheritance_status zend_is_class_subtype_of_type(
571571
return INHERITANCE_UNRESOLVED;
572572
}
573573

574+
// replacing static with self in final classes is okay
574575
if (!is_intersection && fe_scope->ce_flags & ZEND_ACC_FINAL && instanceof_function(fe_scope, proto_scope)) {
575576
if (!fe_ce) fe_ce = lookup_class(fe_scope, fe_class_name);
576577

577-
if (!fe_ce || !instanceof_function(fe_ce, fe_scope)) {
578-
return INHERITANCE_ERROR;
578+
if (fe_ce && instanceof_function(fe_ce, fe_scope)) {
579+
return INHERITANCE_SUCCESS;
579580
}
580581

581-
return INHERITANCE_SUCCESS;
582+
return INHERITANCE_ERROR;
582583
}
583584

584585
return is_intersection ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;

0 commit comments

Comments
 (0)