com php-src: fix broken repeat command: phpdbg.c phpdbg_cmd .c phpdbg_prompt.c
| From: | Bob Weinand | Date: | Tue, 19 Nov 2013 14:06:33 +0000 |
| Subject: | com php-src: fix broken repeat command: phpdbg.c phpdbg_cmd .c phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74801@lists.php.net to get a copy of this message | ||
Commit: b237401167459dd9219fd1a6865b9a12f872c31f
Author: krakjoe <joe.watkins@live.co.uk> Tue, 19 Nov 2013 14:06:33 +0000
Parents: b2a19a42d18eb458bdfdc66c7e3af9ee31386186
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b237401167459dd9219fd1a6865b9a12f872c31f
Log:
fix broken repeat command
Changed paths:
M phpdbg.c
M phpdbg_cmd.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 9f33d84..e7f3403 100644
--- 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";
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index b097223..ca026cf 100644
--- a/phpdbg_cmd.c
+++ b/phpdbg_cmd.c
@@ -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,
¶m 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(
- ¶m TSRMLS_CC);
-
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
+ phpdbg_clear_param(
+ &PHPDBG_G(lparam) TSRMLS_CC);
PHPDBG_G(lparam) = param;
+ rc = command->handler(¶m TSRMLS_CC);
}
break;
}
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 4095f3c..1cbc7db 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -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);