com php-src: Fixed bug #72538 (readline_redisplay crashes php): NEWS ext/readline/readline.c ext/readline/ tests/bug72538.phpt
| From: | Xinchen Hui | Date: | Sun, 03 Jul 2016 15:56:27 +0000 |
| Subject: | com php-src: Fixed bug #72538 (readline_redisplay crashes php): NEWS ext/readline/readline.c ext/readline/ tests/bug72538.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92742@lists.php.net to get a copy of this message | ||
Commit: 612aff3a8a42bb5ef756e60769b16f9879c7f036
Author: Xinchen Hui <laruence@gmail.com> Sun, 3 Jul 2016 23:56:27 +0800
Parents: 6744737577bcbae4ff3d0082f23c9282758cacbb
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=612aff3a8a42bb5ef756e60769b16f9879c7f036
Log:
Fixed bug #72538 (readline_redisplay crashes php)
Bugs:
https://bugs.php.net/72538
Changed paths:
M NEWS
M ext/readline/readline.c
A ext/readline/tests/bug72538.phpt
Diff:
diff --git a/NEWS b/NEWS
index 3e2be90..90df495 100644
--- 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).
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index ad9b01a..362dc2f 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 0000000..98b9b26
--- /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