We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

FlashSession not outputting when setMainView() is being used in indexAction of your controller

I am using


in my indexAction of my Controller.

When I try to set a message


and then disable my view


and redirect to another page

return $this->response->redirect("desired_url");

it doesn't render at all. No output.

However, if I disable the setMainView and allow the view to normally render on my index.phtml page using


the FlashSession works as expected.

This is either a bug or a design flaw. I am not sure which. Anyone else experience this? Maybe I am missing sometthing here...

You must log in first to vote

In this case you need to manually print the messages in the corresponding view:

<p><?php $this->flashSession->output() ?></p>


{{ flashSession.output() }}

Taken from https://docs.phalcon.io/en/latest/reference/flash.html

Hi Jimmy, thank you for your response, however, I have already tried that. That is how it is output when I don't set the Main View. When I do


the output has nothing.