Skip to content

Commit 53e527a

Browse files
committed
Remove ZEND_ACC_IMPLEMENT_INTERFACES flag
This is equivalent to checking ce->num_interfaces. The only subtle moment is during inheritance, where num_interface may change when parent interfaces are inherited. The check in zend_do_link_class thus uses "interfaces", not "ce->num_interfaces".
1 parent 40d615b commit 53e527a

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6523,7 +6523,6 @@ void zend_compile_implements(zend_ast *ast) /* {{{ */
65236523
interface_names[i].lc_name = zend_string_tolower(interface_names[i].name);
65246524
}
65256525

6526-
ce->ce_flags |= ZEND_ACC_IMPLEMENT_INTERFACES;
65276526
ce->num_interfaces = list->children;
65286527
ce->interface_names = interface_names;
65296528
}
@@ -6664,7 +6663,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
66646663

66656664
if (toplevel
66666665
/* We currently don't early-bind classes that implement interfaces or use traits */
6667-
&& !(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES) && !ce->num_traits
6666+
&& !ce->num_interfaces && !ce->num_traits
66686667
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD)) {
66696668
if (extends_ast) {
66706669
zend_class_entry *parent_ce = zend_lookup_class_ex(
@@ -6725,7 +6724,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
67256724
if (extends_ast && toplevel
67266725
&& (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING)
67276726
/* We currently don't early-bind classes that implement interfaces or use traits */
6728-
&& !(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES) && !ce->num_traits
6727+
&& !ce->num_interfaces && !ce->num_traits
67296728
) {
67306729
CG(active_op_array)->fn_flags |= ZEND_ACC_EARLY_BINDING;
67316730
opline->opcode = ZEND_DECLARE_CLASS_DELAYED;

Zend/zend_compile.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ typedef struct _zend_oparray_context {
229229
/* op_array or class is preloaded | | | */
230230
#define ZEND_ACC_PRELOADED (1 << 10) /* X | X | | */
231231
/* | | | */
232-
/* Class Flags (unused: 13, 15, 24...) | | | */
232+
/* Class Flags (unused: 13, 14, 15, 24...) | | | */
233233
/* =========== | | | */
234234
/* | | | */
235235
/* Special class types | | | */
@@ -251,9 +251,6 @@ typedef struct _zend_oparray_context {
251251
/* Class constants updated | | | */
252252
#define ZEND_ACC_CONSTANTS_UPDATED (1 << 12) /* X | | | */
253253
/* | | | */
254-
/* Class implements interface(s) | | | */
255-
#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 14) /* X | | | */
256-
/* | | | */
257254
/* User class has methods with static variables | | | */
258255
#define ZEND_HAS_STATIC_IN_METHODS (1 << 16) /* X | | | */
259256
/* | | | */

Zend/zend_inheritance.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par
11611161

11621162
/* Inherit interfaces */
11631163
if (parent_ce->num_interfaces) {
1164-
if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES)) {
1164+
if (!ce->num_interfaces) {
11651165
zend_do_inherit_interfaces(ce, parent_ce);
11661166
} else {
11671167
uint32_t i;
@@ -2463,7 +2463,7 @@ ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_nam
24632463
if (ce->num_traits) {
24642464
zend_do_bind_traits(ce);
24652465
}
2466-
if (ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES) {
2466+
if (interfaces) {
24672467
zend_do_implement_interfaces(ce, interfaces);
24682468
}
24692469
if ((ce->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) == ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) {

0 commit comments

Comments
 (0)