File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 5
5
- Readline:
6
6
. Fixed bug #55496 (Interactive mode doesn't force a newline before the
7
7
prompt). (Bob, Johannes)
8
+ . Fixed bug #67496 (Save command history when exiting interactive shell
9
+ with control-c). (Dmitry Saprykin, Johannes)
8
10
9
11
?? ??? 2014, PHP 5.4.31
10
12
Original file line number Diff line number Diff line change @@ -590,6 +590,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
590
590
char * code = emalloc (size );
591
591
char * prompt = cli_get_prompt ("php" , '>' TSRMLS_CC );
592
592
char * history_file ;
593
+ int history_lines_to_write = 0 ;
593
594
594
595
if (PG (auto_prepend_file ) && PG (auto_prepend_file )[0 ]) {
595
596
zend_file_handle * prepend_file_p ;
@@ -654,6 +655,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
654
655
655
656
if (* line ) {
656
657
add_history (line );
658
+ history_lines_to_write += 1 ;
657
659
}
658
660
659
661
free (line );
@@ -663,6 +665,15 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
663
665
continue ;
664
666
}
665
667
668
+ if (history_lines_to_write ) {
669
+ #if HAVE_LIBEDIT
670
+ write_history (history_file );
671
+ #else
672
+ append_history (history_lines_to_write , history_file );
673
+ #endif
674
+ history_lines_to_write = 0 ;
675
+ }
676
+
666
677
zend_try {
667
678
zend_eval_stringl (code , pos , NULL , "php shell code" TSRMLS_CC );
668
679
} zend_end_try ();
@@ -684,7 +695,6 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */
684
695
685
696
php_last_char = '\0' ;
686
697
}
687
- write_history (history_file );
688
698
free (history_file );
689
699
efree (code );
690
700
efree (prompt );
You can’t perform that action at this time.
0 commit comments