We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

flasg getMessages bug? It removes all entries

lets say, I put an error into the session:

<?php
$this->flash->error("too bad! the form had errors");
$this->flash->success("yes!, everything went very smoothly");

and when I want to get error ONLY:

<?phpecho $this->flash->message('error');

I found that "success" is also gets removed however I only wanted to get+clear "error"

The correct methods to output are:

$this->flash->output('error');
$this->flash->output('success');

Also note that the flash service is not session persistent. If you want to keep messages between page loads until explicitly rendered, use flashSession



28.2k

yea, Im using flashsession

I don't want to sound smartass, but according to your pasted code you're not (unless you changed the service names).

I've also mentioned the correct method to output the message, which is also invalid in your pasted code...

If you expect help, please be precise regarding your snippets, otherwise we can't help. (The error/bug you mentioned in the first place does not exist, at least not in 2.0.8 version, so there is something wrong in your implementation)