-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.0] Session key persistence issues - File Driver #8244
Comments
Duplicate. This is a known issue. TLDR: The file driver is rubbish, but is fine for local testing. |
This looks like it's a matter of merely writing to the file again every time the set method is called. I'd have to disagree that this is fine for testing, because that's what I'm doing now, however I can't test with something that's not functioning correctly in the first place. Note taken though, I'll use a different driver. This definitely appears to be only happening with the file driver. Any other driver seems fine for this specific issue. Thanks! EDIT: scratch that other comment. Had to clear route cache. |
@GrahamCampbell hmm I see you mention the file driver is rubbish (for sessions) quite often, out of interest what's the issue with it exactly? Is it a performance thing or? |
I experience this issue testing locally too: Laravel Framework version 5.1.3 (LTS) |
The problem I'm going to describe only happens on Laravel 5, this issue is actually non-existent on Laravel 4.2, and the example shown below works just fine.
Inside your laravel 5 application in your routes file, set any session key, then change it like below:
Now retrieve the session key in any controller using
Session::get('test')
, it will returntesting
when it should returnchanged
? Why does it returnchanged
in my routes file but not inside my controllers?I haven't tried other drivers, but this definitely occurs on the file driver. I've discovered that once you delete the session file inside the storage, it will successfully return
changed
, but only when you've manually deleted the session file will it properly change (due to it creating another session with the proper variables).I've cleared all caches, called
Session::forget('test')
, and same issue occurs. It will always return'testing'
until a new session is created or until the session is destroyed. Is this intended?EDIT: Also, inspecting the session file itself on Laravel 4.2 running on the same machine, once a session is created, and a
Session::set()
is called, it successfully updates the file with the proper session keys, however in Laravel 5, this file is never updated after it's created. This isn't an issue of permissions either, I'm running Windows 8.1, PHP 5.6, and the storage folder is completely wide open and writable, and I've also applied full permissions to the session file for any program/user.The text was updated successfully, but these errors were encountered: