8000 Immutable clases and op_arrays by dstogov · Pull Request #3608 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

Immutable clases and op_arrays #3608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
Moved static class members initialization into the proper place.
  • Loading branch information
dstogov committed Oct 17, 2018
commit c63fc5d5f19c58498108d1698055b2b442227eb3
8 changes: 4 additions & 4 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
dst = end + parent_ce->default_static_members_count;
ce->default_static_members_table = end;
}
if (CE_STATIC_MEMBERS(parent_ce) == NULL) {
ZEND_ASSERT(parent_ce->type == ZEND_INTERNAL_CLASS || (parent_ce->ce_flags & ZEND_ACC_IMMUTABLE));
zend_class_init_statics(parent_ce);
}
if (UNEXPECTED(parent_ce->type != ce->type)) {
/* User class extends internal */
if (UNEXPECTED(zend_update_class_constants(parent_ce) != SUCCESS)) {
Expand All @@ -901,10 +905,6 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
} while (dst != end);
} else if (ce->type == ZEND_USER_CLASS) {
if (UNEXPECTED(CE_STATIC_MEMBERS(parent_ce) == NULL)) {
ZEND_ASSERT(parent_ce->type == ZEND_INTERNAL_CLASS || (parent_ce->ce_flags & ZEND_ACC_IMMUTABLE));
zend_class_init_statics(parent_ce);
}
src = CE_STATIC_MEMBERS(parent_ce) + parent_ce->default_static_members_count;
do {
dst--;
Expand Down
0