[Breaking Change] Refactor validation rules: alpha, alpha_dash, alpha_num #45767
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a redo of #45609
Reason for re-submitting PR
The reason why I refactored this again is discussed at #45660 . Please see.
In the previous PR, we received a comment that custom rules should be defined individually by the developer.
However, as described below, there is a problem that the definition of "alphabet" is implemented differently from what is generally known, which is not good for a Web framework widely used in the world.
Also, since we received a lot of support in the above Discussion, we thought it would be better to address this issue as a framework rather than as individual developers.
What is this?
The validation rules: alpha, alpha_dash, alpha_num have a problem.
The common definition of "alphabet" or "alphabetic characters" is the 26 types of characters [a-zA-Z] (52 types of uppercase and lowercase characters combined).
However, Laravel's validation rules for verifying whether an input character is an alphabetic character actually allowed characters that went well beyond the definition of an alphabetic character.
This is the actual "alpha" rule code
The following is the meaning of the properties included in this regular expression (from https://www.php.net/manual/en/regexp.reference.unicode.php)
That's why, I believe the following code is the more correct one
This overly broad definition is contrary to the developers' intentions in a language area such as Japan, where multibyte characters are used on a daily basis.
I shared this opinion in the discussion above and got over 30 Upvodes. This is the second most Upvodes of any discussion topic in the Laravel project.
Changes
What you get from this change