-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Simplify NoSuspiciousCharactersValidator
#54062
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
[Validator] Simplify NoSuspiciousCharactersValidator
#54062
Conversation
src/Symfony/Component/Validator/Constraints/NoSuspiciousCharactersValidator.php
Outdated
Show resolved
Hide resolved
I forgot the case where many checks fail at once; adding a test. This will also solve #54062 (comment). |
816e1fc
to
c24e3e7
Compare
Thank you @MatTheCat. |
->assertRaised(); | ||
; | ||
|
||
while ($message = next($errors)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foreach ($errors as $code => $message)
would be a lot more readable IMO (you will need a special handling of the first item s next ones to create $violations
)
[NoSuspiciousCharacters::HIDDEN_OVERLAY_ERROR => 'Using hidden overlay characters is not allowed.'], | ||
]; | ||
|
||
yield 'Fails both HIDDEN_OVERLAY and RESTRICTION_LEVEL checks' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this test be added in older branches as well (and so all the test refactoring) ?
This PR was merged into the 7.1 branch. Discussion ---------- [Validator] fix compatibility with PHP < 8.2.4 | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT The fix for php/php-src#10647 (on which #54062) relies on was first released with PHP 8.2.4. Commits ------- 2d713ea fix compatibility with PHP < 8.2.4
php/php-src#10647 has been fixed in PHP 8.1.17. Now that Symfony requires PHP ≥ 8.2, we can avoid calling
Spoofchecker::isSuspicious
for every check by leveraging its$errorCode
parameter.