Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuestionHelper's autocomplete mangles multibyte input on backspace #34254

Closed
dotterian opened this issue Nov 6, 2019 · 1 comment
Closed

Comments

@dotterian
Copy link

Symfony version(s) affected: 4.3.3

Description
Due to usage of substr in place of mb_substr in backspace portion of QuestionHelper::autocomplete it remove only one byte from the end of utf-8 strings instead of two, resulting in mangled input and possible errors.

Maybe there are reasons not to use mb_substr?

How to reproduce

  1. Input any utf-8 string in autocomplete input
  2. Tap backspace
  3. Now your input string is damaged beyond recognition

Possible Solution
Quick fix that helped me was to replace substr with mb_substr in backspace handling portion of QuestionHelper::autocomplete

@fancyweb
Copy link
Contributor

fancyweb commented Nov 17, 2019

Status: reviewed

@dotterian Can you please send a pull request with your fix? That would be a nice contribution 😃

nicolas-grekas added a commit that referenced this issue Nov 29, 2019
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Fix autocomplete multibyte input support

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #34254
| License       | MIT
| Doc PR        | -

Added it just where it's needed.

Commits
-------

a1129f9 [Console] Fix autocomplete multibyte input support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants