Skip to content

Commit 9b8fdb3

Browse files
committed
Fix bug #81280 refuse to allow unicode chars in prompts
1 parent 05ef633 commit 9b8fdb3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ext/readline/readline_cli.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ static zend_string *cli_get_prompt(char *block, char prompt) /* {{{ */
135135
{
136136
smart_str retval = {0};
137137
char *prompt_spec = CLIR_G(prompt) ? CLIR_G(prompt) : DEFAULT_PROMPT;
138+
bool unicode_warned = false;
138139

139140
do {
140141
if (*prompt_spec == '\\') {
@@ -193,7 +194,16 @@ static zend_string *cli_get_prompt(char *block, char prompt) /* {{{ */
193194
prompt_spec = prompt_end;
194195
}
195196
} else {
196-
smart_str_appendc(&retval, *prompt_spec);
197+
if (!(*prompt_spec & 0x80)) {
198+
smart_str_appendc(&retval, *prompt_spec);
199+
} else {
200+
if (!unicode_warned) {
201+
zend_error(E_WARNING,
202+
"prompt contains unsupported unicode characters");
203+
unicode_warned = true;
204+
}
205+
smart_str_appendc(&retval, '?');
206+
}
197207
}
198208
} while (++prompt_spec && *prompt_spec);
199209
smart_str_0(&retval);

0 commit comments

Comments
 (0)