]> granicus.if.org Git - php/commitdiff
Fixed bug #72538 (readline_redisplay crashes php)
authorXinchen Hui <laruence@gmail.com>
Sun, 3 Jul 2016 15:56:27 +0000 (23:56 +0800)
committerXinchen Hui <laruence@gmail.com>
Sun, 3 Jul 2016 15:56:27 +0000 (23:56 +0800)
NEWS
ext/readline/readline.c
ext/readline/tests/bug72538.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 3e2be90c5604e39103e7d1bd296d55fc41d33a8e..90df495213cad9042ceb429a57ba4f2b010c9dc5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,9 @@ PHP                                                                        NEWS
   . Fixed bug #72476 (Memleak in jit_stack). (Laruence)
   . Fixed bug #72463 (mail fails with invalid argument). (Anatol)
 
+- Readline:
+  . Fixed bug #72538 (readline_redisplay crashes php). (Laruence)
+
 - Standard:
   . Fixed bug #72505 (readfile() mangles files larger than 2G). (Cschneid)
   . Fixed bug #72306 (Heap overflow through proc_open and $env parameter).
index ad9b01a94645904e001153d91e8b3b86a47565d9..362dc2f8761a373a2c03a4babdd805d1bc135094 100644 (file)
@@ -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 (file)
index 0000000..98b9b26
--- /dev/null
@@ -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