You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Possible Solution
Symfony\Component\Form\Extension\Validator\Constraints\FormValidator -> validate method
my guess problem is form validator runs this method in a loop for each constraint and is overwriting constraint property for cause
/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php#126
// Mark the form with an error if it contains extra fields
if (!$config->getOption('allow_extra_fields') && count($form->getExtraData()) > 0) {
$this->context->setConstraint($constraint);
…bbuh)
This PR was merged into the 3.4 branch.
Discussion
----------
[Form] do not overwrite the constraint being evaluated
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #27362
| License | MIT
| Doc PR |
Commits
-------
345a632 do not overwrite the constraint being evaluated
Symfony version(s) affected: >=3.4.5
Description
forms with disabled 'allow_extra_fields' and with defined constraints in options return wrong constraint in error cause
How to reproduce
<=3.4.4 (correct)
>=3.4.5 (incorrect)
Here is a repository with a reproduction of the problem : https://github.com/AlexeyDubinchak/symfony-formerror-issue
Possible Solution
Symfony\Component\Form\Extension\Validator\Constraints\FormValidator -> validate method
my guess problem is form validator runs this method in a loop for each constraint and is overwriting constraint property for cause
caused because of #25940
The text was updated successfully, but these errors were encountered: