[php-src] master: ext/readline: Compute completion prefix length outside the loop

From: Date: Sun, 11 Oct 2026 06:45:54 +0000
Subject: [php-src] master: ext/readline: Compute completion prefix length outside the loop
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142175@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-10-11T14:45:51+08:00 Commit: https://github.com/php/php-src/commit/a2ec5a32e43a5b434d108b0c18910a368c21a42b Raw diff: https://github.com/php/php-src/commit/a2ec5a32e43a5b434d108b0c18910a368c21a42b.diff ext/readline: Compute completion prefix length outside the loop Changed paths: M ext/readline/readline.c Diff: diff --git a/ext/readline/readline.c b/ext/readline/readline.c index d9ec274996c7..91cd751559ee 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -417,6 +417,7 @@ static char *_readline_command_generator(const char *text, int state) { HashTable *myht = Z_ARRVAL(_readline_array); zval *entry; + size_t text_len = strlen(text); if (!state) { zend_hash_internal_pointer_reset(myht); @@ -426,7 +427,7 @@ static char *_readline_command_generator(const char *text, int state) zend_hash_move_forward(myht); convert_to_string(entry); - if (strncmp (Z_STRVAL_P(entry), text, strlen(text)) == 0) { + if (strncmp (Z_STRVAL_P(entry), text, text_len) == 0) { return (strdup(Z_STRVAL_P(entry))); } }

« previous php.cvs (#142175) next »