iliaa Thu Feb 3 19:22:04 2005 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/readline readline.c
Log:
MFH: Proper fix for bug #31796 .
http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.31.2.2&r2=1.31.2.3&ty=u
Index: php-src/ext/readline/readline.c
diff -u php-src/ext/readline/readline.c:1.31.2.2
php-src/ext/readline/readline.c:1.31.2.3
--- php-src/ext/readline/readline.c:1.31.2.2 Thu Feb 3 17:46:55 2005
+++ php-src/ext/readline/readline.c Thu Feb 3 19:22:03 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: readline.c,v 1.31.2.2 2005/02/03 22:46:55 iliaa Exp $ */
+/* $Id: readline.c,v 1.31.2.3 2005/02/04 00:22:03 iliaa Exp $ */
/* {{{ includes & prototypes */
@@ -354,7 +354,7 @@
}
}
- return strdup("");
+ return NULL;
}
static zval *_readline_string_zval(const char *str)
@@ -393,7 +393,13 @@
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';
+ }
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php