diff options
Diffstat (limited to 'sapi/phpdbg/phpdbg_utils.c')
| -rw-r--r-- | sapi/phpdbg/phpdbg_utils.c | 50 | 
1 files changed, 30 insertions, 20 deletions
| diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index 380e9f9e16..e10eb60d4a 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;  		} @@ -819,7 +824,7 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */  			break;  		case IS_STRING: {  			int i; -			zend_string *str = php_addcslashes(Z_STR_P(zv), 0, "\\\"\n\t\0", 5); +			zend_string *str = php_addcslashes(Z_STR_P(zv), "\\\"\n\t\0", 5);  			for (i = 0; i < ZSTR_LEN(str); i++) {  				if (ZSTR_VAL(str)[i] < 32) {  					ZSTR_VAL(str)[i] = ' '; @@ -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; | 
