magento2
magento2 copied to clipboard
Customer name validation is failed if name contains only special characters
Preconditions and environment
-
Magento version Adobe Commerce ver. 2.4.5-p5
-
Suppose you have various old customer which was created in 2020 and only contains special characters
-
then name validator \Magento\Customer\Model\Validator\Name::isValidName is failed
-
Method should be validated name like this. `private function isValidName($nameValue) { if ($nameValue != null) { if (preg_match(self::PATTERN_NAME, $nameValue, $matches)) { return $matches[0] == $nameValue; } else { return false; } }
return true;}`
-
Anything else that would help a developer reproduce the bug
Steps to reproduce
- Update any customer's first name and last name with special characters only
- then open that customer from the backend Magento
- and just shave that customer Magento
Expected result
we should get the errors like this,
- First Name is not valid!
- Middle Name is not valid!
- Last Name is not valid!
Actual result
its saved the customer with the special charactersIt
Additional information
No response
Release note
No response
Triage and priority
- [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [X] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [X] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [X] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @KaushikChavda. 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. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance- upcoming 2.4.x release- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Dash. 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:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- Verify that issue has a meaningful description and provides enough information to reproduce the issue.
-
- Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Hi @KaushikChavda
Thanks for reporting and collaboration.
Verified the issue on Magento 2.4-develop instance and the issue is reproducible. We are not getting errors messages and able to save the changes successfully when the first ,middle and last name of the customer contains only special characters.Kindly refer the screenshots.
We are considering this as improvisation hence marking this as feature request to proceed further
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-10607 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
@magento I am working on this
Hi @aiqbalm! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.
@magento add to contributors team
Hi @harihhs! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.
@magento add to contributors team
Hi @aiqbalm! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.
@magento I am working on this
any updates? we meet this error when old customer placing order. and we upgrade from v2.3.1 to v2.4.6. please advise, how to solve this problem? thanks
any updates? we meet this error when old customer placing order. and we upgrade from v2.3.1 to v2.4.6. please advise, how to solve this problem? thanks
Did you ever fix this? I'm stuck with the same problem right now
We got today a similar problem where someone try an attack and tried to use the weak validation.
I would agree to change the validation function as @KaushikChavda written.
if ($nameValue != null) {
if (preg_match(PATTERN_NAME, $nameValue, $matches)) {
return $matches[0] == $nameValue;
} else {
return false;
}
}
any updates? we meet this error when old customer placing order. and we upgrade from v2.3.1 to v2.4.6. please advise, how to solve this problem? thanks
Did you ever fix this? I'm stuck with the same problem right now
I made a php code to foreach all the data from table customer_entity, to check all customers' first name and last name field whether match the regexp or not.
the regexp is from file /vendor/magento/module-customer/Model/Validator/Name.php
the private const PATTERN_NAME = '/(?:[\p{L}\p{M},-_.'’`\s\d]){1,255}+/u';
if not match the regexp, then correct the customer's name data.
This method is not smart, but can solve our old customers data. :-)