-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] [Session] lazy session start for #6036 #10156
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
Conversation
This is breaking functional tests of the SecurityBundle (which rely on the session), so something is wrong in your patch |
Will check it later. Seems that there is nobody try to start session at login |
Done. As I said before there is BC, Security tests don't start session at login action, but has option "require_previous_session", this why they don't pass. I make changes in that tests to fix this. Also I create another PR #10310 that haven't BC problem, but use less right way. On my mind #10310 is better PR, people who care about start session on read operation can use its own storage, that implement LazySessionStorageInterface, and don't need to wait major version. And later on major version this interface can be merged with SessionStorageInterface with BC. |
I think to close this PR, because of this line in storage: return isset($_COOKIE[session_name()]); Actually hasPreviousSession in Storage must have Request to work like in Request::hasPreviousSession, but this is very big changes and I'm not sure that this will be right changes and now I haven't idea, how to solve this. |
* | ||
* @return boolean True if previous session exiting, false otherwise. | ||
*/ | ||
public function hasPreviousSession(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SessionStorageInterface is marked as API so it can't be changed.
Its best to introduce a new additional Interface to solve this - LazySessionStorageInterface?
And then check if the storage implements this interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #10310 I make it in this way.
Isn't this a compatibility break, as the session no longer starts automatically? Maybe a add a new LazySession class which implements this 'new' logic without breaking the current situation. In the new class you then can enforce that that the storage implements lazy loading (LazySessionStorageInterface). |
I will think about LazySessionInterface or maybe just check only isStarted inside Session read methods (without additionally check hasPreviousSession). |
This patch solve problem when session starts after call read method like get, has, count without checking that session isStarted.