1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 04:32:19 +02:00

verify noargs

This commit is contained in:
krakjoe
2014-02-21 19:05:20 +00:00
parent 28debb4717
commit 1c5f8ca7e1
2 changed files with 13 additions and 5 deletions

View File

@@ -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;

View File

@@ -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
}; /* }}} */