Skip to content

Commit f801dc9

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

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ext/readline/readline_cli.c

Lines changed: 12 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,17 @@ 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+
if (!unicode_warned) {
199+
zend_error(E_WARNING,
200+
"prompt contains unsupported unicode characters");
201+
unicode_warned = true;
202+
}
203+
204+
smart_str_appendc(&retval, *prompt_spec);
205+
} else {
206+
smart_str_appendc(&retval, '?');
207+
}
197208
}
198209
} while (++prompt_spec && *prompt_spec);
199210
smart_str_0(&retval);

0 commit comments

Comments
 (0)