{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/16852","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/16852/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/16852/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/16852/events","html_url":"https://github.com/laravel/framework/pull/16852","id":196269818,"number":16852,"title":"Fix \"session not saved\" issue when logout","user":{"login":"uicosp","id":14162142,"avatar_url":"https://avatars.githubusercontent.com/u/14162142?v=3","gravatar_id":"","url":"https://api.github.com/users/uicosp","html_url":"https://github.com/uicosp","followers_url":"https://api.github.com/users/uicosp/followers","following_url":"https://api.github.com/users/uicosp/following{/other_user}","gists_url":"https://api.github.com/users/uicosp/gists{/gist_id}","starred_url":"https://api.github.com/users/uicosp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uicosp/subscriptions","organizations_url":"https://api.github.com/users/uicosp/orgs","repos_url":"https://api.github.com/users/uicosp/repos","events_url":"https://api.github.com/users/uicosp/events{/privacy}","received_events_url":"https://api.github.com/users/uicosp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-18T11:04:23Z","updated_at":"2016-12-18T14:30:46Z","closed_at":"2016-12-18T14:30:46Z","pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/16852","html_url":"https://github.com/laravel/framework/pull/16852","diff_url":"https://github.com/laravel/framework/pull/16852.diff","patch_url":"https://github.com/laravel/framework/pull/16852.patch"},"body":"the `$request->session()->regenerate();` generates a new session, then the `$this->manager->driver()->save();` in StartSession middleware will only save the new session.\r\n```php\r\n    public function terminate($request, $response)\r\n    {\r\n        if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) {\r\n            $this->manager->driver()->save();\r\n        }\r\n    }\r\n```\r\n\r\nWe can call save method manually to fix this bug:\r\n```php\r\n$request->session()->flush();\r\n$request->session()->save();\r\n$request->session()->regenerate();\r\n```\r\n\r\nor simply remove the regenerate statement, so the session have been flushed will be saved in StartSession middleware."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/267824324","html_url":"https://github.com/laravel/framework/pull/16852#issuecomment-267824324","issue_url":"https://api.github.com/repos/laravel/framework/issues/16852","id":267824324,"user":{"login":"taylorotwell","id":463230,"avatar_url":"https://avatars.githubusercontent.com/u/463230?v=3","gravatar_id":"","url":"https://api.github.com/users/taylorotwell","html_url":"https://github.com/taylorotwell","followers_url":"https://api.github.com/users/taylorotwell/followers","following_url":"https://api.github.com/users/taylorotwell/following{/other_user}","gists_url":"https://api.github.com/users/taylorotwell/gists{/gist_id}","starred_url":"https://api.github.com/users/taylorotwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylorotwell/subscriptions","organizations_url":"https://api.github.com/users/taylorotwell/orgs","repos_url":"https://api.github.com/users/taylorotwell/repos","events_url":"https://api.github.com/users/taylorotwell/events{/privacy}","received_events_url":"https://api.github.com/users/taylorotwell/received_events","type":"User","site_admin":false},"created_at":"2016-12-18T14:30:46Z","updated_at":"2016-12-18T14:30:46Z","body":"This should not be removed. Would introduce a security bug."}}
{"actor":{"display_login":"taylorotwell"}}