magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Customer group code saved does not match the input when using multibyte characters #39342

Open oskar-olaussen opened 5 days ago

oskar-olaussen commented 5 days ago

Preconditions and environment

Steps to reproduce

  1. In admin go to Customer->Customer Groups.
  2. Click "Add New Customer Group"
  3. Input 31 "ö" characters as the group name: Screenshot from 2024-11-07 16-35-27
  4. Click "Save Customer Group".

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: https://github.com/magento/magento2/blob/6acfd6aa744c905f7694f2cddd5b0add5bf202b7/app/code/Magento/Customer/Model/Group.php#L175 and https://github.com/magento/magento2/blob/6acfd6aa744c905f7694f2cddd5b0add5bf202b7/app/code/Magento/Customer/Model/ResourceModel/Group.php#L127 .

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

m2-assistant[bot] commented 5 days ago

Hi @oskar-olaussen. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.

m2-assistant[bot] commented 4 days ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 1 day ago

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.

Screenshot 2024-11-11 at 10 09 28

A customer group with code "öööööööööööööööö" (16 characters) is created.

Hence Confirming the issue.

Thanks.

github-jira-sync-bot commented 1 day ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13335 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 day ago

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.