symfony/symfony — pull request #10690 by GromNaN (2014-04-10 23:06:24+00:00)
Title: [Validator] Fix hack for nested Collection/All losing context

The PR https://github.com/silexphp/Silex/pull/943 highlighted [a hack in `ConstraintValidatorFactory`](https://github.com/symfony/symfony/commit/d4ebbfd02d416504ebfed262d656941062905b76#diff-3a3e44a703775a35fbdd66850a43968dR48).

The issue that is solved by this hack it that the context injected into the `ConstraintValidator` can change during the execution of the method `validate()` ; because the same instance of the validator is reused.

The hack was fixing this issue for the `Collection` constraint only. This patch fixes also the `All` constraint as it can be nested too (see the new test case coded by @harrytruong).

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/silexphp/Silex/pull/943
| License | MIT
| Doc PR | no