Fixed Bug #66412 readline_clear_history() with libedit causes segfault after #65714

Checking all libedit functions, this check is done in each functions (add_history,
read_history, write_history, ...) but is missing in clear_history.

Test coverage: readline_clear_history_001.phpt
This commit is contained in:
Remi Collet 2014-01-20 08:38:53 +01:00
parent 4e55c6bffb
commit 31d67bd353
2 changed files with 9 additions and 0 deletions

4
NEWS
View File

@ -17,6 +17,10 @@ PHP NEWS
. Fixed bug #66298 (ext/opcache/Optimizer/zend_optimizer.c has dos-style
^M as lineend). (Laruence)
- Readline
. Fixed Bug #66412 (readline_clear_history() with libedit causes segfault after
#65714). (Remi)
- Session
. Fixed bug #66469 (Session module is sending multiple set-cookie headers when
session.use_strict_mode=1) (Yasuo)

View File

@ -354,6 +354,11 @@ PHP_FUNCTION(readline_clear_history)
return;
}
#if HAVE_LIBEDIT
/* clear_history is the only function where rl_initialize
is not call to ensure correct allocation */
using_history();
#endif
clear_history();
RETURN_TRUE;