-
Notifications
You must be signed in to change notification settings - Fork 38
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
Sane default for cookie path #46
Conversation
@basz don't they start it for all sub-paths anyway if you set it to |
Yes With '/' things work as expected, with http://tools.ietf.org/html/rfc6265#section-5.1.4
|
This is unclear to me: what was the behavior without the path? What was sent, and what was expected instead? |
While testing psr7session I included it as pre routing middleware it into zend-expressive-skeleton. I also wrote some middleware that increments a value, let's call it 'ssn', and stores it onto the session container. The skeleton application has two actions and on both I pulled the ssn value from the session storage and passed it to the view. One in the footer and one in the Json payload and I was expecting to see that value increment on every request. This worked in principle - a refresh will increment the displayed ssn value. The psr7session worked. Yeah! However when I went from the homepage action to the ping action the ssn value restarted with 0. Refreshing that page would successfully increment ssn. Going back to the homepage the value didn't reset to zero but continued increasing from its previous value. In effect I was having two sessions each with it own ssn value. Took me it took me a while before I realized the path option of the cookie was set to null which would make each path have its own cookie. Setting the path option to '/' solved the issue. Now every request under '/' has the same cookie and thus session... Clearer? I can setup a demo somewhere, can't explain it any better with words...
|
Soo, this pr is not a bug fix for psr7session nor the cookie library. It is just a better default.
|
Ok, now that makes more sense :-)
|
I think this should also be fixed inside the factories, but we'll need to release 2.0.0 for this fix to be merged, as it is a breaking change. |
auch..... indeed. however you could argue that because its behaviour was broken in the first place - although strictly speaking a breaking change - no one could be using it as it is at the moment? |
It is a BC break regardless. Bumping major version is not a tabu: if it's Marco Pivetta On 16 January 2016 at 14:58, Bas Kamer [email protected] wrote:
|
… always has a `/` path by default
Browsers will start a new session for every uri without it ->withPath('/')