Skip to content

Commit 75fa917

Browse files
committed
bug symfony#58866 [Validator] fix compatibility with PHP < 8.2.4 (xabbuh)
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 symfony#54062) relies on was first released with PHP 8.2.4. Commits ------- 2d713ea fix compatibility with PHP < 8.2.4
2 parents 49f4c44 + 2d713ea commit 75fa917

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/Validator/Constraints/NoSuspiciousCharactersValidator.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,17 @@ public function validate(mixed $value, Constraint $constraint): void
9999
}
100100

101101
foreach (self::CHECK_ERROR as $check => $error) {
102-
if (!($errorCode & $check)) {
102+
if (\PHP_VERSION_ID < 80204) {
103+
if (!($checks & $check)) {
104+
continue;
105+
}
106+
107+
$checker->setChecks($check);
108+
109+
if (!$checker->isSuspicious($value)) {
110+
continue;
111+
}
112+
} elseif (!($errorCode & $check)) {
103113
continue;
104114
}
105115

0 commit comments

Comments
 (0)