diff --git a/controller.rst b/controller.rst index d2cb16261f1..ab04d9ecb51 100644 --- a/controller.rst +++ b/controller.rst @@ -188,8 +188,8 @@ For more information, see the :doc:`Routing chapter `. .. caution:: - The ``redirect()`` method does not check its destination in any way. If you - redirect to some URL provided by the end-users, your application may be open + The ``redirect()`` method does not check its destination in any way. If you + redirect to some URL provided by the end-users, your application may be open to the `unvalidated redirects security vulnerability`_. @@ -425,21 +425,43 @@ read any flash messages from the session: .. code-block:: html+twig {# app/Resources/views/base.html.twig #} - {% for flash_message in app.session.flashBag.get('notice') %} + + {# you can read and display just one flash message type... #} + {% for flash_message in app.session.flash('notice') %}
{{ flash_message }}
{% endfor %} + {# ...or you can read and display every flash message available #} + {% for type, flash_messages in app.session.flashes %} + {% for flash_message in flash_messages %} +
+ {{ flash_message }} +
+ {% endif %} + {% endfor %} + .. code-block:: html+php + + // you can read and display just one flash message type... getFlash('notice') as $message): ?>
- $message
" ?> + + // ...or you can read and display every flash message available + getFlashes() as $type => $flash_messages): ?> + +
+ +
+ + + .. note:: It's common to use ``notice``, ``warning`` and ``error`` as the keys of the