Skip to content

Commit 7864a62

Browse files
committed
No real need to pass base_iface
1 parent 8110720 commit 7864a62

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

Zend/tests/inheritance/enum_only_interfaces_error_via_indirect_interface.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ class C implements I {
1212

1313
?>
1414
--EXPECTF--
15-
Fatal error: Non-enum class C cannot implement interface I in %s on line %d
15+
Fatal error: Non-enum class C cannot implement interface UnitEnum in %s on line %d

Zend/zend_inheritance.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,18 +1579,13 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
15791579
}
15801580
/* }}} */
15811581

1582-
static inline void do_implement_interface_ex(zend_class_entry *ce, const zend_class_entry *inherited_iface, zend_class_entry *base_iface)
1582+
static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface)
15831583
{
1584-
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && inherited_iface->interface_gets_implemented && inherited_iface->interface_gets_implemented(base_iface, ce) == FAILURE) {
1585-
zend_error_noreturn(E_CORE_ERROR, "%s %s could not implement interface %s", zend_get_object_type_uc(ce), ZSTR_VAL(ce->name), ZSTR_VAL(base_iface->name));
1584+
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce) == FAILURE) {
1585+
zend_error_noreturn(E_CORE_ERROR, "%s %s could not implement interface %s", zend_get_object_type_uc(ce), ZSTR_VAL(ce->name), ZSTR_VAL(iface->name));
15861586
}
15871587
/* This should be prevented by the class lookup logic. */
1588-
ZEND_ASSERT(ce != base_iface);
1589-
}
1590-
1591-
static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface)
1592-
{
1593-
do_implement_interface_ex(ce, iface, iface);
1588+
ZEND_ASSERT(ce != iface);
15941589
}
15951590

15961591
static void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
@@ -1622,7 +1617,7 @@ static void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *i
16221617

16231618
/* and now call the implementing handlers */
16241619
while (ce_num < ce->num_interfaces) {
1625-
do_implement_interface_ex(ce, ce->interfaces[ce_num++], iface);
1620+
do_implement_interface(ce, ce->interfaces[ce_num++]);
16261621
}
16271622
}
16281623
/* }}} */

0 commit comments

Comments
 (0)