The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Cookie Session in middleware

Scott Nicolson's Avatar

Scott Nicolson

13 May, 2013 08:39 PM

I am trying to set a Session value using the super global $_SESSION in a middleware but it doesn't get set and saved.

I have invoked the Slim\Midddleware\SessionCookie after my custom middleware. I am basically setting a flag $_SESSION['flag'] = true and redirecting using $this->app->redirect('/'). after the redirect he session is still empty.

I have put var_exports in my middleware and the session middleware around the calls to load and session and get the following output:

// loading session debug message
// my middleware debug message
// saving session debug message

Any ideas where i might be going wrong?


Showing page 3 out of 3. View the first page

  1. 61 Posted by zirufuko on 27 Sep, 2017 02:28 AM

    zirufuko's Avatar
  2. 62 Posted by root on 19 Oct, 2017 05:48 PM

    root's Avatar

    you serve good knowledge

  3. 63 Posted by Andserson on 15 Dec, 2017 09:49 PM

    Andserson's Avatar

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac