Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 77f39fe

Browse filesBrowse files
committed
bug #53350 [Validator] fix the exception being thrown (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Validator] fix the exception being thrown | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT An `UnexpectedValueException` is caught and transformed into a violation (`UnexpectedTypeException` indicates a misconfiguration of a constraint and is not caught). see also #27917 Commits ------- 3a8f10b fix the exception being thrown
2 parents df36583 + 3a8f10b commit 77f39fe
Copy full SHA for 77f39fe

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed

‎src/Symfony/Component/Validator/Constraints/JsonValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/JsonValidator.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\ConstraintValidator;
1616
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
17+
use Symfony\Component\Validator\Exception\UnexpectedValueException;
1718

1819
/**
1920
* @author Imad ZAIRIG <imadzairig@gmail.com>
@@ -34,7 +35,7 @@ public function validate($value, Constraint $constraint)
3435
}
3536

3637
if (!\is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
37-
throw new UnexpectedTypeException($value, 'string');
38+
throw new UnexpectedValueException($value, 'string');
3839
}
3940

4041
$value = (string) $value;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.