diff options
Diffstat (limited to 'sapi/phpdbg/phpdbg_bp.c')
| -rw-r--r-- | sapi/phpdbg/phpdbg_bp.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 738967f907..db3d1cf0c4 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -830,7 +828,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co { phpdbg_breakcond_t new_break; uint32_t cops = CG(compiler_options); - zval pv; + zend_string *bp_code; switch (param->type) { case STR_PARAM: @@ -879,16 +877,10 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co new_break.code = estrndup(expr, expr_len); new_break.code_len = expr_len; - Z_STR(pv) = zend_string_alloc(expr_len + sizeof("return ;") - 1, 0); - memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); - memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_len); - Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; - Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; - Z_TYPE_INFO(pv) = IS_STRING; - - new_break.ops = zend_compile_string(&pv, "Conditional Breakpoint Code"); - - zval_ptr_dtor_str(&pv); + bp_code = zend_string_concat3( + "return ", sizeof("return ")-1, expr, expr_len, ";", sizeof(";")-1); + new_break.ops = zend_compile_string(bp_code, "Conditional Breakpoint Code"); + zend_string_release(bp_code); if (new_break.ops) { brake = zend_hash_index_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, sizeof(phpdbg_breakcond_t)); @@ -908,7 +900,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co PHPDBG_API void phpdbg_set_breakpoint_expression(const char *expr, size_t expr_len) /* {{{ */ { - zend_ulong expr_hash = zend_inline_hash_func(expr, expr_len); + zend_ulong expr_hash = zend_hash_func(expr, expr_len); phpdbg_breakcond_t new_break; if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], expr_hash)) { @@ -927,7 +919,7 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param) /* {{{ */ if (param->next) { condition = param->next; - hash = zend_inline_hash_func(condition->str, condition->len); + hash = zend_hash_func(condition->str, condition->len); if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash)) { phpdbg_create_conditional_break(&new_break, param, condition->str, condition->len, hash); |
