{"action":"closed","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/11391","labels_url":"https://api.github.com/repos/laravel/framework/issues/11391/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/11391/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/11391/events","html_url":"https://github.com/laravel/framework/issues/11391","id":122754759,"number":11391,"title":"[5.1] Undefined index: _sf2_meta when changing Session driver in middleware with redis set as session driver.","user":{"login":"carvefx","id":346798,"avatar_url":"https://avatars.githubusercontent.com/u/346798?v=3","gravatar_id":"","url":"https://api.github.com/users/carvefx","html_url":"https://github.com/carvefx","followers_url":"https://api.github.com/users/carvefx/followers","following_url":"https://api.github.com/users/carvefx/following{/other_user}","gists_url":"https://api.github.com/users/carvefx/gists{/gist_id}","starred_url":"https://api.github.com/users/carvefx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carvefx/subscriptions","organizations_url":"https://api.github.com/users/carvefx/orgs","repos_url":"https://api.github.com/users/carvefx/repos","events_url":"https://api.github.com/users/carvefx/events{/privacy}","received_events_url":"https://api.github.com/users/carvefx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-17T15:13:41Z","updated_at":"2015-12-17T15:16:58Z","closed_at":"2015-12-17T15:16:58Z","body":"My issue is exactly the one https://github.com/laravel/framework/issues/7586\r\nAnd the solution of setting the session driver before the session start middleware works in my case.\r\n\r\nHOWEVER:\r\nrecently we decided we want to change to using redis instead of memcache, as a result the error is back.\r\n\r\nStack:\r\n```\r\nexception;\r\nErrorException\r\nmessage:\r\nUndefined index: _sf2_meta\r\noriginating_file:\r\n/var/www/web/dupery/htdocs/bootstrap/cache/compiled.php\r\nstack_trace:\r\n\r\n#0 /var/www/web/dupery/htdocs/bootstrap/cache/compiled.php(11736): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined index...', '/var/www/web/du...', 11736, Array)\r\n#1 /var/www/web/dupery/htdocs/bootstrap/cache/compiled.php(11723): Illuminate\\Session\\Store->addBagDataToSession()\r\n#2 /var/www/web/dupery/htdocs/bootstrap/cache/compiled.php(11546): Illuminate\\Session\\Store->save()\r\n#3 /var/www/web/dupery/htdocs/bootstrap/cache/compiled.php(2258): Illuminate\\Session\\Middleware\\StartSession->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))\r\n#4 /var/www/web/dupery/htdocs/public/index.php(57): Illuminate\\Foundation\\Http\\Kernel->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))\r\n#5 {main}\r\n```\r\n\r\nrelevant lines from Kernel.php\r\n```\r\n  protected $middleware = [\r\n    'Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode',\r\n    'Illuminate\\Cookie\\Middleware\\EncryptCookies',\r\n    'Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse',\r\n    // needs to be above StartSession because it modifies the default session\r\n    'App\\Http\\Middleware\\ChangeSessionToArray',\r\n    'Illuminate\\Session\\Middleware\\StartSession',\r\n    'Illuminate\\View\\Middleware\\ShareErrorsFromSession',\r\n    'App\\Http\\Middleware\\VerifyCsrfToken',\r\n  ];\r\n```\r\n\r\nrelevant lines from ChangeSessionToArray.php\r\n```\r\npublic function handle($request, Closure $next)\r\n  {\r\n      \\Config::set('session.driver', 'array');\r\n      return $next($request);\r\n  }\r\n```\r\n\r\ntrued both ```config()->set()``` and ```null``` instead of ```'array'```\r\n\r\nCurrently the only way to avoid this is by keeping memcached as a session driver and redis as a cache driver.\r\n\r\nAny suggestions?"}}