]> granicus.if.org Git - php/commitdiff
verify noargs
authorkrakjoe <joe.watkins@live.co.uk>
Fri, 21 Feb 2014 19:05:20 +0000 (19:05 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Fri, 21 Feb 2014 19:05:20 +0000 (19:05 +0000)
phpdbg_cmd.c
phpdbg_prompt.c

index 416aab8a42330c08a0185c7ceaf7154b1c647599..4d34be74a917ee28e1fb09b8dcef6a828578f730 100644 (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;
                
index 6d7cbb0b971c64b4a8bfc936a44be575b77db122..25f2a3abd36916465f749a299334cbf53076cc41 100644 (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
 }; /* }}} */