Skip to content

[5.0] Session key persistence issues - File Driver #8244

@stevebauman

Description

@stevebauman

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:

//routes.php

Session::set('test', 'testing');
Session::get('test'); // Returns 'testing'

Session::set('test', 'changed');
Session::get('test'); // Returns 'changed'

Now retrieve the session key in any controller using Session::get('test'), it will return testing when it should return changed? Why does it return changed 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions