Skip to content

Commit 03384ca

Browse files
committed
Don't initialize static_member_tables during start-up, when inherit internal classes.
1 parent 1257664 commit 03384ca

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Zend/zend_inheritance.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,11 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
885885
dst = end + parent_ce->default_static_members_count;
886886
ce->default_static_members_table = end;
887887
}
888-
if (CE_STATIC_MEMBERS(parent_ce) == NULL) {
889-
ZEND_ASSERT(parent_ce->type == ZEND_INTERNAL_CLASS || (parent_ce->ce_flags & ZEND_ACC_IMMUTABLE));
890-
zend_class_init_statics(parent_ce);
891-
}
892888
if (UNEXPECTED(parent_ce->type != ce->type)) {
893889
/* User class extends internal */
890+
if (CE_STATIC_MEMBERS(parent_ce) == NULL) {
891+
zend_class_init_statics(parent_ce);
892+
}
894893
if (UNEXPECTED(zend_update_class_constants(parent_ce) != SUCCESS)) {
895894
ZEND_ASSERT(0);
896895
}
@@ -905,6 +904,10 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
905904
}
906905
} while (dst != end);
907906
} else if (ce->type == ZEND_USER_CLASS) {
907+
if (CE_STATIC_MEMBERS(parent_ce) == NULL) {
908+
ZEND_ASSERT(parent_ce->ce_flags & ZEND_ACC_IMMUTABLE);
909+
zend_class_init_statics(parent_ce);
910+
}
908911
src = CE_STATIC_MEMBERS(parent_ce) + parent_ce->default_static_members_count;
909912
do {
910913
dst--;

0 commit comments

Comments
 (0)