From: krakjoe Date: Fri, 21 Feb 2014 19:05:20 +0000 (+0000) Subject: verify noargs X-Git-Tag: php-5.6.0beta2~1^2~37^2~20^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c5f8ca7e10997ba3742e2ff9de26408297c4c82;p=php verify noargs --- diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index 416aab8a42..4d34be74a9 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -532,7 +532,7 @@ PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param) } /* }}} */ PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param_t **stack, char **why TSRMLS_DC) { - if (command && command->args) { + if (command) { char buffer[128] = {0,}; const phpdbg_param_t *top = (stack != NULL) ? *stack : NULL; const char *arg = command->args; @@ -542,8 +542,16 @@ PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param zend_bool optional = 0; /* check for arg spec */ - if (!(arg) || !(*arg)) - return SUCCESS; + if (!(arg) || !(*arg)) { + if (!top) { + return SUCCESS; + } + + asprintf(why, + "%s expected no arguments", + phpdbg_command_name(command, buffer)); + return FAILURE; + } least = 0L; diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 6d7cbb0b97..25f2a3abd3 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -52,7 +52,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = { PHPDBG_COMMAND_D(finish, "continue past the end of the stack", 'F', NULL, 0), PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L', NULL, 0), PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, "s"), - PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, 0), + PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, "*|c"), PHPDBG_COMMAND_D(back, "show trace", 't', NULL, "|n"), PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, "|n"), PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, "*"), @@ -63,7 +63,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = { PHPDBG_COMMAND_D(set, "set phpdbg configuration", 'S', phpdbg_set_commands, "s"), PHPDBG_COMMAND_D(register,"register a function", 'R', NULL, "s"), PHPDBG_COMMAND_D(source, "execute a phpdbginit", '.', NULL, "s"), - PHPDBG_COMMAND_D(shell, "shell a command", '-', NULL, 0), + PHPDBG_COMMAND_D(shell, "shell a command", '-', NULL, "i"), PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q', NULL, 0), PHPDBG_END_COMMAND }; /* }}} */