Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Sessions don't stick
  • Hey, I was wondering if anyone can help me solve this problem. I've been trying to set Sessions in the action_404(), but they don't seem to stick. They stick when I go to the index page, but as soon as I touch the action_404(), the session won't stick anymore. Any solutions?
  • Hi shinin, 404's are handled in a different way to how Fuel normally serves pages etc... so that maybe the reason.
  • Hey, call \Session::write(); It's called when Fuel sends the response and shuts down, and when you throw a 404 it just creates a new response and doesn't actually call the shutdown, which means it never actually writes to the driver.
    // Set in the class
    \Session::set('foo', 'bar');
    
    // Write to the driver
    \Session::write();
    
  • If that is the case, I'll classify that as a bug. I'll look into that. edit: it terminates with exit, which is not done, as shutdown events won't be executed. I'll fix this. edit: has been fixed.
  • Cool, thanks everyone!

Howdy, Stranger!

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

In this Discussion