It has been tested by me and my workmate.

Using print_r returns a big output with a lot of noise. Nothing to do with
the expected results as describe in the doc.

When passing directly $errors, the output is exaclty the one described in
the doc. :)


*Thierry Goettelmann*
Développement Web
contact@byscripts.info


2013/11/27 Christophe Coevoet <notifications@github.com>

> In book/validation.rst:
>
> > @@ -129,7 +129,7 @@ simple example from inside a controller::
> >          $errors = $validator->validate($author);
> >
> >          if (count($errors) > 0) {
> > -            return new Response(print_r($errors, true));
> > +            return new Response($errors);
>
> This will not work. The Response constructor expects a string or an object
> castable to string. ConstraintViolationList is not
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/symfony/symfony-docs/pull/3229/files#r7957999>
> .
>