summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg/phpdbg_utils.c')
-rw-r--r--sapi/phpdbg/phpdbg_utils.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 380e9f9e16..71194633ab 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -687,10 +687,12 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(zv);
- if (ZEND_HASH_APPLY_PROTECTION(myht) && ++myht->u.v.nApplyCount > 1) {
- phpdbg_xml("<recursion />");
- --myht->u.v.nApplyCount;
- break;
+ if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
+ if (GC_IS_RECURSIVE(myht)) {
+ phpdbg_xml("<recursion />");
+ break;
+ }
+ GC_PROTECT_RECURSION(myht);
}
phpdbg_xml("<array refstatus=\"%s\" num=\"%d\">", COMMON, zend_hash_num_elements(myht));
element_dump_func = phpdbg_xml_array_element_dump;
@@ -698,9 +700,8 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
goto head_done;
case IS_OBJECT:
myht = Z_OBJDEBUG_P(zv, is_temp);
- if (myht && ++myht->u.v.nApplyCount > 1) {
+ if (myht && GC_IS_RECURSIVE(myht)) {
phpdbg_xml("<recursion />");
- --myht->u.v.nApplyCount;
break;
}
@@ -715,7 +716,7 @@ head_done:
element_dump_func(val, key, num);
} ZEND_HASH_FOREACH_END();
zend_hash_apply_with_arguments(myht, (apply_func_args_t) element_dump_func, 0);
- --myht->u.v.nApplyCount;
+ GC_UNPROTECT_RECURSION(myht);
if (is_temp) {
zend_hash_destroy(myht);
efree(myht);
@@ -759,21 +760,25 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen
return 1;
}
- do {
+ cur = &op_array->opcodes[catch];
+ while (1) {
zend_class_entry *ce;
- cur = &op_array->opcodes[catch];
- if (!(ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(cur->op1))))) {
- ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(cur->op1)), EX_CONSTANT(cur->op1) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
- CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(cur->op1)), ce);
+ if (!(ce = CACHED_PTR(cur->extended_value & ~ZEND_LAST_CATCH))) {
+ ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(cur, cur->op1)), RT_CONSTANT(cur, cur->op1) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
+ CACHE_PTR(cur->extended_value & ~ZEND_LAST_CATCH, ce);
}
if (ce == exception->ce || (ce && instanceof_function(exception->ce, ce))) {
return 1;
}
- catch += cur->extended_value / sizeof(zend_op);
- } while (!cur->result.num);
+ if (cur->extended_value & ZEND_LAST_CATCH) {
+ return 0;
+ }
+
+ cur = OP_JMP_ADDR(cur, cur->op2);
+ }
return 0;
}
@@ -843,12 +848,17 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen ? 0 : '+');
break;
}
- case IS_CONSTANT:
- decode = estrdup("<constant>");
- break;
- case IS_CONSTANT_AST:
- decode = estrdup("<ast>");
+ case IS_CONSTANT_AST: {
+ zend_ast *ast = Z_ASTVAL_P(zv);
+
+ if (ast->kind == ZEND_AST_CONSTANT
+ || ast->kind == ZEND_AST_CONSTANT_CLASS) {
+ decode = estrdup("<constant>");
+ } else {
+ decode = estrdup("<ast>");
+ }
break;
+ }
default:
spprintf(&decode, 0, "unknown type: %d", Z_TYPE_P(zv));
break;