-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Session] Fixed bug with mock file session storage #6342
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
Fixed a bug where an unstarted mock session would be emptied with a save
ping @Drak |
I think the logical reasoning is right because there a real unstarted session wouldn't call any save-handlers... but, what disturbs me is that the framework should not be calling the It's possible that a complete fix should actually include both checks, although I would suggest an exception be thrown in MockFileSessionStorage because something unexpected is happening and you should be notified about it. What do you think? Let me know the result of the test suggested above. (Regarding the branch question - bug fixes for the session should be branched from and applied to the 2.1 branch because it's a bug fix. Merges are applied up from the lowest branch affected. You have applied a branch to |
Ok. I tested @Drak's suggestion, and it does indeed fix the problem. Here is what I will do:
How does that sound? |
@baldurrensch Sounds good to me. |
Yes submit a new PR. |
I opened a new PR against the correct branch: #6362 |
This PR was merged into the 2.1 branch. Commits ------- 098b593 [Session] Added exception to save method 6b9ee87 [Session] Fixed a bug with the TestListener Discussion ---------- [Session] Fixed bug with TestListener Fixed a bug where an unstarted mock session would be emptied with a save. Here are the steps to reproduce: Use the test client from Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient(), and add something to its session. (I actually had it authenticate against a firewall). Take the cookies of this first test client and add them to a second test client Have the second test client request a URL that results in a 404 Since the 404 does not need to start the session, hence when save is called (automatically), the mock session is overwritten with an empty array. This does not happen with the other session handlers. The added unit test in this PR shows this problem. If this PR gets accepted, will it also get merged into the 2.1.x-dev branch? Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes (The broken test seems to be unrelated to this change) Fixes the following tickets: - Todo: - License of the code: MIT Documentation PR: - This is a follow up PR since my original one (symfony#6342) was against the wrong upstream branch.
Fixed a bug where an unstarted mock session would be emptied with a save. Here are the steps to reproduce:
Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient()
, and add something to its session. (I actually had it authenticate against a firewall).The added unit test in this PR shows this problem. If this PR gets accepted, will it also get merged into the 2.1.x-dev branch?
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes (The broken test seems to be unrelated to this change)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -