Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Session flash message disappearing after redirect
  • I don't know what I changed but whenever I set a Session::flash('key','value') followed by a
    Response::redirect('somewhere')
    

    The flash is lost, how do I debug this?
  • I think you can set "flash_auto_expire" to false in Session config look here
    http://docs.fuelphp.com/classes/session/config.html Chris
  • Chris P wrote on Friday 10th of February 2012:
    I think you can set "flash_auto_expire" to false in Session config look here
    http://docs.fuelphp.com/classes/session/config.html Chris

    Tried that with no difference. That's why I'm really lost . Heres the controller I'm testing, this will not output
    class Controller_Welcome extends Controller_Template {
    
        public function before() {
            
            parent::before();
    
            try {
                if (Sentry::check()) {
                    Response::redirect('home');
                }
            } catch (SentryUserException $e) {
                Sentry::logout();
            }
            
            
        }
    
        public function action_test(){
            Session::set_flash('success', 'some value');
            
            Response::redirect('welcome/index');
        }
    }
    
    This will work if I directly output the view
    class Controller_Welcome extends Controller_Template {
    
        public function before() {
            
            parent::before();
    
            try {
                if (Sentry::check()) {
                    Response::redirect('home');
                }
            } catch (SentryUserException $e) {
                Sentry::logout();
            }
            
            
        }
    
        public function action_test($data = null){
            Session::set_flash('success', 'some value');
            
           $this->template->content = View::forge('welcome/index', $data);
        }
    }
    
  • So I figured out that it's the Sentry::logout method that is killing all the session vars but not sure how to tackle it without making changes to the sentry package.
  • Report it as an issue to Sentry. Sentry should not destroy the session on logout (destroying sessions for purposes like that is always a bad idea), instead they should only remove the Sentry specific variables.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion