summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-07-03 23:56:27 +0800
committerXinchen Hui <laruence@gmail.com>2016-07-03 23:56:27 +0800
commit612aff3a8a42bb5ef756e60769b16f9879c7f036 (patch)
tree86bd1d62c3a365c940c9e2e2c643f8ec73657b75 /ext/readline
parent6744737577bcbae4ff3d0082f23c9282758cacbb (diff)
downloadphp-git-612aff3a8a42bb5ef756e60769b16f9879c7f036.tar.gz
Fixed bug #72538 (readline_redisplay crashes php)
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c5
-rw-r--r--ext/readline/tests/bug72538.phpt15
2 files changed, 20 insertions, 0 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index ad9b01a946..362dc2f876 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -616,6 +616,11 @@ PHP_FUNCTION(readline_callback_handler_remove)
Ask readline to redraw the display */
PHP_FUNCTION(readline_redisplay)
{
+#if HAVE_LIBEDIT
+ /* seems libedit doesn't take care of rl_initialize in rl_redisplay
+ * see bug #72538 */
+ using_history();
+#endif
rl_redisplay();
}
/* }}} */
diff --git a/ext/readline/tests/bug72538.phpt b/ext/readline/tests/bug72538.phpt
new file mode 100644
index 0000000000..98b9b2651e
--- /dev/null
+++ b/ext/readline/tests/bug72538.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #72538 (readline_redisplay crashes php)
+--SKIPIF--
+<?php if (!extension_loaded("readline")) die("skip");
+if (READLINE_LIB != "libedit") die("skip libedit only");
+?>
+--FILE--
+<?php
+
+readline_redisplay();
+
+?>
+okey
+--EXPECT--
+okey