com php-src: Fixed bug #71094: NEWS ext/readline/readline.c

From: Date: Fri, 11 Dec 2015 15:33:07 +0000
Subject: com php-src: Fixed bug #71094: NEWS ext/readline/readline.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90234@lists.php.net to get a copy of this message
Commit: 04407b79dfa41a38a6bce3823b3f80eab9ce3ae8 Author: Nikita Popov <nikic@php.net> Fri, 11 Dec 2015 16:32:10 +0100 Parents: fd3ece8578326410ccd045332c57e6fec5a88bad Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=04407b79dfa41a38a6bce3823b3f80eab9ce3ae8 Log: Fixed bug #71094 I didn't see any non-dummy readline tests to work off, so this change is tested manually only. While at it also fix other zval_dtors and use ZVAL_COPY. Bugs: https://bugs.php.net/71094 Changed paths: M NEWS M ext/readline/readline.c Diff: diff --git a/NEWS b/NEWS index 89c5fa8..6f2b4b2 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,10 @@ PHP NEWS . Fixed bug #71066 (mb_send_mail: Program terminated with signal SIGSEGV, Segmentation fault). (Laruence) +- Readline: + . Fixed bug #71094 (readline_completion_function corrupts static array on + second TAB). (Nikita) + - SPL: . Fixed bug #71077 (ReflectionMethod for ArrayObject constructor returns wrong number of parameters). (Laruence) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 47e59d8..5aca051 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -188,7 +188,7 @@ PHP_MSHUTDOWN_FUNCTION(readline) PHP_RSHUTDOWN_FUNCTION(readline) { - zval_dtor(&_readline_completion); + zval_ptr_dtor(&_readline_completion); ZVAL_UNDEF(&_readline_completion); #if HAVE_RL_CALLBACK_READ_CHAR if (Z_TYPE(_prepped_callback) != IS_UNDEF) { @@ -505,7 +505,7 @@ static char **_readline_completion_cb(const char *text, int start, int end) for (i = 0; i < 3; i++) { zval_ptr_dtor(&params[i]); } - zval_dtor(&_readline_array); + zval_ptr_dtor(&_readline_array); return matches; } @@ -526,8 +526,8 @@ PHP_FUNCTION(readline_completion_function) } zend_string_release(name); - zval_dtor(&_readline_completion); - ZVAL_DUP(&_readline_completion, arg); + zval_ptr_dtor(&_readline_completion); + ZVAL_COPY(&_readline_completion, arg); rl_attempted_completion_function = _readline_completion_cb; if (rl_attempted_completion_function == NULL) { @@ -552,7 +552,7 @@ static void php_rl_callback_handler(char *the_line) call_user_function(CG(function_table), NULL, &_prepped_callback, &dummy, 1, params); zval_ptr_dtor(&params[0]); - zval_dtor(&dummy); + zval_ptr_dtor(&dummy); } /* {{{ proto void readline_callback_handler_install(string prompt, mixed callback) @@ -577,10 +577,10 @@ PHP_FUNCTION(readline_callback_handler_install) if (Z_TYPE(_prepped_callback) != IS_UNDEF) { rl_callback_handler_remove(); - zval_dtor(&_prepped_callback); + zval_ptr_dtor(&_prepped_callback); } - ZVAL_DUP(&_prepped_callback, callback); + ZVAL_COPY(&_prepped_callback, callback); rl_callback_handler_install(prompt, php_rl_callback_handler); @@ -604,7 +604,7 @@ PHP_FUNCTION(readline_callback_handler_remove) { if (Z_TYPE(_prepped_callback) != IS_UNDEF) { rl_callback_handler_remove(); - zval_dtor(&_prepped_callback); + zval_ptr_dtor(&_prepped_callback); ZVAL_UNDEF(&_prepped_callback); RETURN_TRUE; }

« previous php.cvs (#90234) next »