Skip to content

Commit

Permalink
Initialise statics for PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jun 11, 2019
1 parent 32620c3 commit 9cf1237
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xdebug_handler_dbgp.c
Expand Up @@ -1880,6 +1880,12 @@ static int attach_context_vars(xdebug_xml_node *node, xdebug_var_export_options
if (fse->function.type == XFUNC_STATIC_MEMBER) {
zend_class_entry *ce = xdebug_fetch_class(fse->function.class, strlen(fse->function.class), ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC);

#if PHP_VERSION_ID >= 70400
if (ce->type == ZEND_INTERNAL_CLASS || (ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
zend_class_init_statics(ce);
}
#endif

xdebug_attach_static_vars(node, options, ce TSRMLS_CC);
}

Expand Down
11 changes: 11 additions & 0 deletions xdebug_var.c
Expand Up @@ -327,6 +327,11 @@ static void fetch_zval_from_symbol_table(
case XF_ST_STATIC_ROOT:
case XF_ST_STATIC_PROPERTY:
/* First we try a public,private,protected property */
#if PHP_VERSION_ID >= 70400
if (cce && (cce->type == ZEND_INTERNAL_CLASS || (cce->ce_flags & ZEND_ACC_IMMUTABLE))) {
zend_class_init_statics(cce);
}
#endif
element = prepare_search_key(name, &element_length, "", 0);
if (cce && ((zpp = zend_hash_str_find_ptr(&cce->properties_info, element, element_length)) != NULL) && CE_STATIC_MEMBERS(cce)) {
ZVAL_COPY(&tmp_retval, &CE_STATIC_MEMBERS(cce)[zpp->offset]);
Expand Down Expand Up @@ -2151,6 +2156,12 @@ void xdebug_var_export_xml_node(zval **struc, xdebug_str *name, xdebug_xml_node
/* Adding static properties */
xdebug_zend_hash_apply_protection_begin(&ce->properties_info);

#if PHP_VERSION_ID >= 70400
if (ce->type == ZEND_INTERNAL_CLASS || (ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
zend_class_init_statics(ce);
}
#endif

ZEND_HASH_FOREACH_PTR(&ce->properties_info, zpi_val) {
object_item_add_zend_prop_to_merged_hash(zpi_val, merged_hash, (int) XDEBUG_OBJECT_ITEM_TYPE_STATIC_PROPERTY, ce);
} ZEND_HASH_FOREACH_END();
Expand Down

0 comments on commit 9cf1237

Please sign in to comment.