symfony/symfony — pull request #10007 by entering (2014-01-12 15:21:08+00:00)
Title: [Validator] Fixed constraint violation to string handles array

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |

This bug was introduced on [PR-790 [2.3] [Validator] added comparison constraints and validators](https://github.com/symfony/symfony/pull/790)

Due to the change on root (to become the value):
```diff
- $context = new ExecutionContext($this->createVisitor(null), $this->translator, $this->translationDomain);
+ $context = new ExecutionContext($this->createVisitor($value), $this->translator, $this->translationDomain);
```
https://github.com/symfony/symfony/pull/790/files#diff-f4a93c3d8fcb85a24ea41c2a993e6d83R163

My change on:
```diff
- $class = (string) (is_object($this->root) ? get_class($this->root) : $this->root);
+ $class = is_object($this->root)
+ ? get_class($this->root)
+ : (is_array($this->root) ? 'Array' : (string) $this->root);
+
```

Is "inspired" on [TypeValidator](https://github.com/symfony/symfony/blob/07992d352c8293cdae5a65e7e27fac5254ecbc49/src/Symfony/Component/Validator/Constraints/TypeValidator.php#L47)