Skip to content

Update Length constraint description (mb_strlen) #11456

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

Merged
merged 1 commit into from
Apr 23, 2019
Merged

Update Length constraint description (mb_strlen) #11456

merged 1 commit into from
Apr 23, 2019

Conversation

guilliamxavier
Copy link
Contributor

The current implementation (3.4 and 4.2) uses only mb_strlen (after mb_check_encoding).

History: years ago the grapheme_strlen attempt was replaced with iconv_strlen (and preg_replace), later on the whole implementation (including plain strlen) was reduced to keep only iconv_strlen, and finally (but still years ago) iconv_strlen was replaced with mb_check_encoding + mb_strlen.

@javiereguiluz javiereguiluz added this to the 3.4 milestone Apr 23, 2019
@javiereguiluz javiereguiluz merged commit 03bd47f into symfony:3.4 Apr 23, 2019
javiereguiluz added a commit that referenced this pull request Apr 23, 2019
…amxavier)

This PR was merged into the 3.4 branch.

Discussion
----------

Update Length constraint description (mb_strlen)

The current implementation ([3.4] and [4.2]) uses only `mb_strlen` (after `mb_check_encoding`).

[3.4]: https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Validator/Constraints/LengthValidator.php#L42-L44
[4.2]: https://github.com/symfony/symfony/blob/4.2/src/Symfony/Component/Validator/Constraints/LengthValidator.php#L43-L45

History: [years ago][1] the `grapheme_strlen` attempt was replaced with `iconv_strlen` (and `preg_replace`), [later on][2] the whole implementation (including plain `strlen`) was reduced to keep only `iconv_strlen`, and [finally][3] (but still years ago) `iconv_strlen` was replaced with `mb_check_encoding` + `mb_strlen`.

[1]: symfony/symfony@915fcd8
[2]: symfony/symfony@303f05b#diff-467932f4ce8a7100a8e0184cf9463e6a
[3]: symfony/symfony@27f5f81#diff-467932f4ce8a7100a8e0184cf9463e6a

Commits
-------

03bd47f Update Length constraint description (mb_strlen)
@javiereguiluz
Copy link
Member

@guilliamxavier nice fix and fantastic explanation! Thank you.

@guilliamxavier guilliamxavier deleted the patch-1 branch April 23, 2019 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants