From bd395cf749af942130d25dd51abd9142d4ee0480 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 6 Jan 2021 18:56:02 +0100 Subject: [PATCH] Avoid modifying the return value of readline_completion_function() The internal function `_readline_command_generator()` modifies the internal array pointer of `readline_completion_function()`'s return value. We therefore separate the array, what also avoids failing assertions regarding the array refcount. --- ext/readline/readline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 174556d4d3f4..d0a4d7a0621e 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -555,6 +555,7 @@ static char **_readline_completion_cb(const char *text, int start, int end) if (call_user_function(NULL, NULL, &_readline_completion, &_readline_array, 3, params) == SUCCESS) { if (Z_TYPE(_readline_array) == IS_ARRAY) { + SEPARATE_ARRAY(&_readline_array); if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) { matches = rl_completion_matches(text,_readline_command_generator); } else {