com php-src: verify noargs: phpdbg_cmd.c phpdbg_prompt .c
| From: | Bob Weinand | Date: | Fri, 21 Feb 2014 19:05:20 +0000 |
| Subject: | com php-src: verify noargs: phpdbg_cmd.c phpdbg_prompt .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77044@lists.php.net to get a copy of this message | ||
Commit: 1c5f8ca7e10997ba3742e2ff9de26408297c4c82
Author: krakjoe <joe.watkins@live.co.uk> Fri, 21 Feb 2014 19:05:20 +0000
Parents: 28debb47173b5ca7f48a0199d6b6a330b80857ff
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1c5f8ca7e10997ba3742e2ff9de26408297c4c82
Log:
verify noargs
Changed paths:
M phpdbg_cmd.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index 416aab8..4d34be7 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 6d7cbb0..25f2a3a 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
}; /* }}} */