summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2014-07-24 18:02:00 +0200
committerJohannes Schlüter <johannes@php.net>2014-07-24 18:02:00 +0200
commit0ac3d8d4f4309136f8db2fbfe6dcaf249572cc16 (patch)
tree9fc7288db3107a728190a60fdea2c40bb0a07dee
parent6fdbb4601f73fa254175897c3fc7b3fe995f9b7e (diff)
parent8d1ec3814e1b3f00a7afe2f32e2989121b3ae647 (diff)
downloadphp-git-0ac3d8d4f4309136f8db2fbfe6dcaf249572cc16.tar.gz
Merge branch 'PHP-5.6'
-rw-r--r--ext/readline/readline_cli.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index 9655777775..9c27acb193 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -590,6 +590,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
char *code = emalloc(size);
char *prompt = cli_get_prompt("php", '>' TSRMLS_CC);
char *history_file;
+ int history_lines_to_write = 0;
if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
zend_file_handle *prepend_file_p;
@@ -654,6 +655,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
if (*line) {
add_history(line);
+ history_lines_to_write += 1;
}
free(line);
@@ -663,6 +665,15 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
continue;
}
+ if (history_lines_to_write) {
+#if HAVE_LIBEDIT
+ write_history(history_file);
+#else
+ append_history(history_lines_to_write, history_file);
+#endif
+ history_lines_to_write = 0;
+ }
+
zend_try {
zend_eval_stringl(code, pos, NULL, "php shell code" TSRMLS_CC);
} zend_end_try();
@@ -684,7 +695,6 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
php_last_char = '\0';
}
- write_history(history_file);
free(history_file);
efree(code);
efree(prompt);