diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 6ab2417c9ac..1fa15ecdb0c 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -96,34 +96,18 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */ phpdbg_param_t *name = NULL; if (stack->type == STACK_PARAM) { - char *lc_name; - name = stack->next; if (!name || name->type != STR_PARAM) { return FAILURE; } - lc_name = zend_str_tolower_dup(name->str, name->len); - - if (zend_hash_str_exists(&PHPDBG_G(registered), lc_name, name->len)) { - zval fretval; - zend_fcall_info fci; - - memset(&fci, 0, sizeof(zend_fcall_info)); - - ZVAL_STRINGL(&fci.function_name, lc_name, name->len); - fci.size = sizeof(zend_fcall_info); - fci.object = NULL; - fci.retval = &fretval; - fci.param_count = 0; - fci.params = NULL; - fci.named_params = NULL; - - zval params; + zend_function *user_fn = zend_hash_str_find_ptr_lc(&PHPDBG_G(registered), name->str, name->len); + if (user_fn != NULL) { + HashTable *params_ht = NULL; if (name->next) { phpdbg_param_t *next = name->next; - + zval params; array_init(¶ms); while (next) { @@ -173,27 +157,19 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */ next = next->next; } /* Add positional arguments */ - fci.named_params = Z_ARRVAL(params); + params_ht = Z_ARRVAL(params); + phpdbg_debug("created " PRIu32 " params from arguments", zend_hash_num_elements(params_ht)); } phpdbg_activate_err_buf(0); phpdbg_free_err_buf(); - phpdbg_debug("created %d params from arguments", fci.param_count); - if (zend_call_function(&fci, NULL) == SUCCESS) { - zend_print_zval_r(&fretval, 0); - phpdbg_out("\n"); - zval_ptr_dtor(&fretval); - } - - zval_ptr_dtor_str(&fci.function_name); - efree(lc_name); + zend_call_known_function(user_fn, NULL, NULL, NULL, 0, NULL, params_ht); + phpdbg_out("\n"); return SUCCESS; } - - efree(lc_name); } return FAILURE;