Skip to content

Commit 9450893

Browse files
committed
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. Closes GH-6582.
1 parent d1b1c04 commit 9450893

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ext/readline/readline.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ static char **_readline_completion_cb(const char *text, int start, int end)
555555

556556
if (call_user_function(NULL, NULL, &_readline_completion, &_readline_array, 3, params) == SUCCESS) {
557557
if (Z_TYPE(_readline_array) == IS_ARRAY) {
558+
SEPARATE_ARRAY(&_readline_array);
558559
if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) {
559560
matches = rl_completion_matches(text,_readline_command_generator);
560561
} else {

0 commit comments

Comments
 (0)