summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-02-04 00:21:50 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-02-04 00:21:50 +0000
commit779edcb01d804db15d69a6c2e46abb7e1c768370 (patch)
tree0be6dbb2434903318b3b701eb93532843bc8e8ae /ext/readline
parent5879c5cf2197e57d71676dc5d9c2689b85f14d17 (diff)
downloadphp-git-779edcb01d804db15d69a6c2e46abb7e1c768370.tar.gz
Proper fix for bug #31796 .
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index a11646b29a..28d7ed709c 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -377,7 +377,7 @@ static char *_readline_command_generator(char *text,int state)
}
}
- return strdup("");
+ return NULL;
}
static zval *_readline_string_zval(const char *str)
@@ -420,7 +420,13 @@ static char **_readline_completion_cb(const char *text, int start, int end)
if (call_user_function(CG(function_table), NULL, _readline_completion, &_readline_array, 3, params TSRMLS_CC) == SUCCESS) {
if (Z_TYPE(_readline_array) == IS_ARRAY) {
- matches = completion_matches(text,_readline_command_generator);
+ if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) {
+ matches = completion_matches(text,_readline_command_generator);
+ } else {
+ matches = malloc(sizeof(char *) * 2);
+ matches[0] = strdup("");
+ matches[1] = '\0';
+ }
}
}