-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Customer group code saved does not match the input when using multibyte characters #39342
Comments
Hi @oskar-olaussen. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Bravo. Thank you for working on this issue.
|
Hi @oskar-olaussen, Thanks for your reporting and collaboration. We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots. A customer group with code "öööööööööööööööö" (16 characters) is created. Hence Confirming the issue. Thanks. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-13335 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Bravo. Thank you for verifying the issue. |
@magento I'm working on this |
@oskar-olaussen, what is the use case, when you need a customer group code both:
|
@ihor-sviziev Well the main point is to have the system working logically when there are multibyte characters present. So either prevent user from having them in the customer group code or fix the unexpected behaviour. Please note that I chose an extreme example where there are just multibyte characters present. The same unexpected behaviour will happen if you have a long customer group code with some of the chars being multibyte. I came across this when I was trying to match customer codes with an external system that had customer group identifiers longer than 32 characters and containing multibyte chars. Tried then truncate the customer group codes to the max allowed length in Magento but noticed that the code saved did not match the input given. A more realistic example: If I save a customer group called "Käärijä-fanien alennusryhmä kesä" what currently gets saved is "Käärijä-fanien alennusryhmä ". |
Preconditions and environment
Steps to reproduce
Expected result
A customer group with code "ööööööööööööööööööööööööööööööö" is created.
Actual result
A customer group with code "öööööööööööööööö" (16 characters) is created.
Additional information
The issue is most likely in these two places:
magento2/app/code/Magento/Customer/Model/Group.php
Line 175 in 6acfd6a
magento2/app/code/Magento/Customer/Model/ResourceModel/Group.php
Line 127 in 6acfd6a
There we are using the substr function instead of mb_substr. I see no issue with using mb_substr as the database can handle 32 multibyte characters fine.
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: