Permalink
Browse files

minor #3555 Wrap variables in {} for safer interpolation (ifdattic)

This PR was merged into the 2.3 branch.

Discussion
----------

Wrap variables in {} for safer interpolation

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3
| Fixed tickets |

Commits
-------

4046476 Replace double quotes with single quotes
0f7a189 Change interpolation to concatenation
d3839ce Wrap variables in {} for safer interpolation
  • Loading branch information...
weaverryan committed Feb 16, 2014
2 parents 5f02bca + 4046476 commit f4bb017d99b225c2ab06490633cb9d30bc0e456c
Showing with 4 additions and 4 deletions.
  1. +4 −4 components/http_foundation/sessions.rst
@@ -28,7 +28,7 @@ Quick example::
// retrieve messages
foreach ($session->getFlashBag()->get('notice', array()) as $message) {
echo "<div class='flash-notice'>$message</div>";
echo '<div class="flash-notice">'.$message.'</div>';
}
.. note::
@@ -308,18 +308,18 @@ Simple, display one type of message::
// display warnings
foreach ($session->getFlashBag()->get('warning', array()) as $message) {
echo "<div class='flash-warning'>$message</div>";
echo '<div class="flash-warning">'.$message.'</div>';
}
// display errors
foreach ($session->getFlashBag()->get('error', array()) as $message) {
echo "<div class='flash-error'>$message</div>";
echo '<div class="flash-error">'.$message.'</div>';
}
Compact method to process display all flashes at once::
foreach ($session->getFlashBag()->all() as $type => $messages) {
foreach ($messages as $message) {
echo "<div class='flash-$type'>$message</div>\n";
echo '<div class="flash-'.$type.'">'.$message.'</div>';
}
}

0 comments on commit f4bb017

Please sign in to comment.