diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-02-04 00:21:58 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-02-04 00:21:58 +0000 |
commit | f01a236c0903076a07b4524c1bceb9e78566056c (patch) | |
tree | 6213694114e7aeefb1aa4db39a892925297dfbbc | |
parent | 3bee7394566cb50e75d92feaf0734ec8fc193535 (diff) | |
download | php-git-f01a236c0903076a07b4524c1bceb9e78566056c.tar.gz |
MFH: Proper fix for bug #31796 .
-rw-r--r-- | ext/readline/readline.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 31a65bb0d0..67e48bb6fa 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -354,7 +354,7 @@ static char *_readline_command_generator(char *text,int state) } } - return strdup(""); + return NULL; } static zval *_readline_string_zval(const char *str) @@ -393,7 +393,13 @@ static char **_readline_completion_cb(char *text, int start, int end) if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1 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'; + } } } |