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

Session issue with flashSession

Hi guys, seem to be having an issue with flash session, only happening on one action

public function confirmAction()
{
    $email = urldecode($this->dispatcher->getParam('email'));

    $user = Users::findFirstByEmail($email);

    if ($user) {
        $user->setConfirmed(Users::USER_CONFIRMED_TRUE);

        if ($user->save()) {
            $this->flash->success('Account confirmed, you may now login');
        } else {
            $this->flash->error('Failed to confirm account...');
        }
    } else {
        $this->flash->error('Failed to confirm account...');
    }

    return $this->response->redirect('/');
}

This works everywhere else but here, and the issue is, the session is set but only shown after you refresh one more time after the redirect so not entirely sure what the issue is. has anyone else experienced this issue?



1.4k
Accepted
answer
edited Apr '15

Hi,

the injected flash service is there an instance of Phalcon\Flash\Session ?