summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2014-02-02 14:58:39 +0000
committerkrakjoe <joe.watkins@live.co.uk>2014-02-02 14:58:39 +0000
commite8519bc2074b97d84f63574e5f832ba19cbcdf9f (patch)
treec03a23f81d5fe8c1a761d1d6bea6880784e68f17
parent6a6bec44add665fc8330eb03161dc36d278ed40d (diff)
downloadphp-git-e8519bc2074b97d84f63574e5f832ba19cbcdf9f.tar.gz
another patch from upstream
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index c700851243..1d78c53321 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -479,7 +479,7 @@ disconnect:
#ifndef HAVE_LIBREADLINE
if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
- if (!phpdbg_write(phpdbg_get_prompt(TSRMLS_C))) {
+ if (!phpdbg_write("%s", phpdbg_get_prompt(TSRMLS_C))) {
goto disconnect;
}
}
@@ -595,6 +595,8 @@ PHPDBG_API int phpdbg_do_cmd(const phpdbg_command_t *command, phpdbg_input_t *in
(command->alias == *input->argv[0]->string))) {
phpdbg_param_t param;
+ phpdbg_command_t *initial_last_cmd;
+ phpdbg_param_t initial_last_param;
param.type = EMPTY_PARAM;
@@ -657,15 +659,20 @@ PHPDBG_API int phpdbg_do_cmd(const phpdbg_command_t *command, phpdbg_input_t *in
}
}
+ initial_last_param = PHPDBG_G(lparam);
+ initial_last_cmd = (phpdbg_command_t *)PHPDBG_G(lcmd);
+ PHPDBG_G(lparam) = param;
+ PHPDBG_G(lcmd) = (phpdbg_command_t *)command;
+
rc = command->handler(&param, input TSRMLS_CC);
/* only set last command when it is worth it! */
- if ((rc != FAILURE) &&
- !(PHPDBG_G(flags) & PHPDBG_IS_INITIALIZING)) {
- PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
- phpdbg_clear_param(
- &PHPDBG_G(lparam) TSRMLS_CC);
- PHPDBG_G(lparam) = param;
+ if (rc != FAILURE && !(PHPDBG_G(flags) & PHPDBG_IS_INITIALIZING)) {
+ phpdbg_clear_param(&initial_last_param TSRMLS_CC);
+ } else if (PHPDBG_G(lcmd) == command && !memcmp(&PHPDBG_G(lparam),& initial_last_param, sizeof(phpdbg_param_t))) {
+ PHPDBG_G(lparam) = initial_last_param;
+ PHPDBG_G(lcmd) = initial_last_cmd;
+ phpdbg_clear_param(&param TSRMLS_CC);
}
break;
}