]> granicus.if.org Git - php/commitdiff
fix broken repeat command
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 19 Nov 2013 14:06:33 +0000 (14:06 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 19 Nov 2013 14:06:33 +0000 (14:06 +0000)
phpdbg.c
phpdbg_cmd.c
phpdbg_prompt.c

index 9f33d8410620f30c6871bc4d82c108775e0e08da..e7f34036104d98e912a5cb596a4f2ae3bb11132e 100644 (file)
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -60,9 +60,18 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
     REGISTER_LONG_CONSTANT("PHPDBG_LINENO", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT);
     REGISTER_LONG_CONSTANT("PHPDBG_FUNC",    STR_PARAM, CONST_CS|CONST_PERSISTENT);
 
+       php_output_startup();
+       
     return SUCCESS;
 } /* }}} */
 
+static PHP_MSHUTDOWN_FUNCTION(phpdbg)
+{
+       php_output_shutdown();
+       
+       return SUCCESS;
+}
+
 static void php_phpdbg_destroy_bp_file(void *brake) /* {{{ */
 {
        zend_llist_destroy((zend_llist*)brake);
@@ -105,7 +114,7 @@ static void php_phpdbg_destroy_registered(void *data)
 }
 
 static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
-{
+{      
        zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE],   8, NULL, php_phpdbg_destroy_bp_file, 0);
        zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0);
     zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
@@ -383,7 +392,6 @@ const char phpdbg_ini_hardcoded[] =
        "html_errors=Off\n"
        "register_argc_argv=On\n"
        "implicit_flush=On\n"
-       "output_buffering=Off\n"
        "display_errors=Off\n"
        "max_execution_time=0\n"
        "max_input_time=-1\n\0";
index b09722334a6c3f24c5fd149cb30969d6e214c1e6..ca026cf7debe24af0f4a04947238dc7e14d210c7 100644 (file)
@@ -198,13 +198,14 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
        while (command && command->name && command->handler) {
                if ((command->name_len == expr_len && memcmp(cmd, command->name, expr_len) == 0)
                        || (expr_len == 1 && command->alias && command->alias == cmd_line[0])) {
-                       phpdbg_param_t param = {0};
-
+                       
+                       phpdbg_param_t param;
+                       
                        phpdbg_parse_param(
                                expr,
                                (cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
                                &param TSRMLS_CC);
-
+                       
                        if (command->subs && param.type == STR_PARAM) {
                                if (phpdbg_do_cmd(command->subs, param.str, param.len TSRMLS_CC) == SUCCESS) {
                                        rc = SUCCESS;
@@ -219,11 +220,11 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
                                phpdbg_error("This command does not expect argument!");
                                rc = FAILURE;
                        } else {
-                               rc = command->handler(
-                                       &param TSRMLS_CC);
-                               
                                PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
+                               phpdbg_clear_param(
+                                       &PHPDBG_G(lparam) TSRMLS_CC);
                                PHPDBG_G(lparam) = param;
+                               rc = command->handler(&param TSRMLS_CC);
                        }
                        break;
                }
index 4095f3c29843324e062c4aff29093d1ed9f631ea..1cbc7db3a00a93d1f1e7ba37a05628f61066c3c9 100644 (file)
@@ -969,7 +969,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */
 
        phpdbg_input_t* input = phpdbg_read_input(TSRMLS_C);
        
-       if (input) {
+       if (input && input->length > 0L) {
                do {
                        switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input->string, input->length TSRMLS_CC)) {
                                case FAILURE:
@@ -995,9 +995,14 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */
                                efree(input->string);
                        }
                        efree(input);
-                                               
-               } while ((input = phpdbg_read_input(TSRMLS_C)));
+                       
+               } while ((input = phpdbg_read_input(TSRMLS_C)) && (input->length > 0L));
+               
+               if (!input->length)
+                       goto last;
+
        } else {
+last:
                if (PHPDBG_G(lcmd)) {
                        ret = PHPDBG_G(lcmd)->handler(
                                        &PHPDBG_G(lparam) TSRMLS_CC);