-
Notifications
You must be signed in to change notification settings - Fork 11.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
[5.5] Allow the distinct validation rule to optionally ignore case #21757
Conversation
Which language rules are used to calculate case sensitivity? Should preg be called with It would make sense to write some tests that are using non-ascii characters. I'll use my favorite characters for this; dotted and dotless i from Turkish.
|
@sisve I've added the Unicode flag to the preg call. Not sure the best way to specify the language rules to use. |
I'm not sure I have enough experience in this area to make a good decision here. @sisve do you have any further input after the latest changes? |
It is not clear how preg/pcre handles locales. The documentation of The IntlChar::tolower also fails. The Collator class has no way to compare case-insensitive. I believe the solution is to write an library for handling languages, locales, encodings and everything. It is always out-of-scope for whatever I was actually looking into when I came to this conclusion. The turkish characters are always watching, silently waiting for their time. I see no reasonable solution for these at the moment. With this said, the code is not escaping the $value it uses to generate the pattern, which will cause issues if the value contains slashes. |
conform to style guide add unicode support escape slashes in regular expression
I updated the code to escape the |
I'm kind of confused by the wording. Wouldn't it be better to call it "case_sensitive". It seems like adding the parameter makes the check fail if the cases don't match? |
The rule is currently case sensitive, and The flag affects the comparison; and a match should fail the validation. The logic error here is that the tests aren't checking the |
Added the 'ignore_case' parameter to the distinct validation rule to allow case insensitive check for distinct values.