Hi, i have updated phalcon from 1.3.x to 2.0.9 and I am seeing some unexpected behaviour in the use of FlashSession->getMessages() and I am not sure if it is a bug or normal behaviour.
I'm adding flashmessages with \Phalcon\Flash\Session
$this->flashSession->error('oops something is wrong');
and in my volt i have these for loops to retrieve each message per type. This was working fine with 1.3.x
{% for m in flashSession.getMessages('success') %}
<div class="alert alert-success">{{ m }}</div>
{% endfor %}
{% for m in flashSession.getMessages('error') %}
<div class="alert alert-error">{{ m }}</div>
{% endfor %}
This doesnt work anymore. Only the first loop is working. If i add a flashmessage with success('hello'); it is showing but with error(' bye'); it is not showing. So I took a look in the code and it looks like all sessions of the flash messages are being removed instead of only the messages of the type of the first parameter if you call getMessages(type).
the method _getSessionMessages(boolean remove, type = null)
that is being called by \Phalcon\Flash\Session::getMessages()
ends with:
if(remove) { session->remove('_flashMessages') }
https://github.com/phalcon/cphalcon/blob/2.0.x/phalcon/flash/session.zep
Is this the way it should work or is it a bug?
ps i have no clue how i am suppose to use coding blocks here... the suggested way with backticks is messing up my message?