diff --git a/src/Symfony/Component/Validator/ConstraintViolationList.php b/src/Symfony/Component/Validator/ConstraintViolationList.php index a66c6040c8..baeaef224b 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationList.php +++ b/src/Symfony/Component/Validator/ConstraintViolationList.php @@ -29,9 +29,13 @@ class ConstraintViolationList implements \IteratorAggregate, \Countable, \ArrayA foreach ($this->violations as $violation) { $root = $violation->getRoot(); - $class = is_object($root) ? get_class($root) : $root; + $class = (string) (is_object($root) ? get_class($root) : $root); + $propertyPath = (string) $violation->getPropertyPath(); + if ('' !== $propertyPath && '[' !== $propertyPath{0} && '' !== $class) { + $class .= '.'; + } $string .= <<getPropertyPath()}: +{$class}{$propertyPath}: {$violation->getMessage()} EOF;