Skip to content

Commit

Permalink
Merge branch 'PHP-5.5' into PHP-5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes committed Jul 24, 2014
2 parents 210315d + acfa8c7 commit 8d1ec38
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ext/readline/readline_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -654,6 +655,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */

if (*line) {
add_history(line);
history_lines_to_write += 1;
}

free(line);
Expand All @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 8d1ec38

Please sign in to comment.