Closed
Description
Symfony version(s) affected: 4.1.3
Description
When saving a boolean to the flash bag, the value is converted to an integer.
The code example below has worked for years, and is currently broken. Has something changed in Symfony?
How to reproduce
if ($form->isSubmitted() && $form->isValid()) {
$this->addFlash('status', true);
return $this->redirectToRoute(...);
}
$this->addFlash('status', false);
{% from 'general/notify.html.twig' import error, success %}
{% for status in app.flashes('status') %}
{% if status is same as(true) %}
{% success('Saved successfully' | trans) %}
{% elseif status is same as(false) %}
{% error('An error occurred' | trans) %}
{% endif %}
{% endfor %}
The message will not be printed. After some digging, it turns out that boolean values are converted to integers.
Note: our session data is saved in Memcached.