diff options
Diffstat (limited to 'sapi/phpdbg/phpdbg_bp.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_bp.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index a29d4442fb..db3d1cf0c4 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -828,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: @@ -877,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)); |