Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Session] fixed wrong started state #9246

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

Closed
wants to merge 1 commit into from
Closed

[Session] fixed wrong started state #9246

wants to merge 1 commit into from

Conversation

tecbot
Copy link

@tecbot tecbot commented Oct 8, 2013

Currently the session stays in the started mode after the call of save() which will close the session. We found the issue in our custom SAPI which keeps the symfony stack initialized over multiple requests.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

@fabpot
Copy link
Member

fabpot commented Oct 9, 2013

ping @Drak

@ghost
Copy link

ghost commented Oct 10, 2013

Looks ok.

fabpot added a commit that referenced this pull request Oct 10, 2013
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #9246).

Discussion
----------

[Session] fixed wrong started state

Currently the session stays in the started mode after the call of  ```save()``` which will close the session. We found the issue in our custom SAPI which keeps the symfony stack initialized over multiple requests.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

d641cd6 [Session] fixed wrong started states
@fabpot fabpot closed this Oct 10, 2013
@Tobion
Copy link
Contributor

Tobion commented Nov 1, 2013

This fixed #7936

@Tobion Tobion mentioned this pull request Nov 1, 2013
@Taluu
Copy link
Contributor

Taluu commented Nov 18, 2013

Hi,

It seems this may introduce a regression. I'm currently on 2.2.4 a(as I proceeded step by step through each versions), then the login seems to works well.

But when I'm on the 2.2.10, I can't login, due to these messages :

INFO - Authentication request failed: Your session has timed out, or you have disabled cookies.
DEBUG - Redirecting to /login

Indeed, it seems the PHPSESSID (which is the default session name) is not created for a reason i can't really get.

I just commented the line $this->started = false in the NativeSessionStorage and it works. To be able to let the isStarted method return false once the session has been saved, I changed its content from return $this->started to return $this->started && !$this->closed which made my app work...

But I don't think this should be the proper solution (it seems way too much tinkered)...

Maybe I'm doing something wrong (like a wrong config, ... which is then not mentionned in the upgrade or changelogs), or this is indeed a regression.

If you want, I may create another to discuss this point ?

@tetronomis
Copy link

I have the same issue as Taluu.
The Set-Cookie header of my response now has this line:
my_cookie_name=deleted; expires=Sun, 18-Nov-2012 21:40:04 GMT; path=/; domain=.mydomain.com;

With same code and reverting back to v2.3.6 i don't have the issue

Taluu added a commit to Taluu/symfony that referenced this pull request Nov 19, 2013
This regression was introduced by symfony#9246 ; if this PR
was to set the session to "not started" was it was saved (and thus
closed), for an unknown reason, the PHPSESSID cookie was never
created for some apps.

But if we modify the isStarted method, and take into account the
$this->closed state, then it should enact the sought behaviour
without introducing this (possible) regression
Taluu added a commit to Taluu/symfony that referenced this pull request Nov 25, 2013
This introduced a regression from symfony#9246, with an incomplete fix ;
As the `started` flag on the NativeSessionStorage was not `true`
anymore when saving the session, the session id was always empty
when saving it, and thus when sending the `PHPSESSID` cookie
Taluu added a commit to Taluu/symfony that referenced this pull request Nov 27, 2013
This introduced a regression from symfony#9246, with an incomplete fix ;
As the `started` flag on the NativeSessionStorage was not `true`
anymore when saving the session, the session id was always empty
when saving it, and thus when sending the `PHPSESSID` cookie
fabpot added a commit that referenced this pull request Nov 28, 2013
…ession was closed (Taluu)

This PR was merged into the 2.2 branch.

Discussion
----------

[HttpFoundation] Do not return an empty session id if the session was closed

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7936
| License       | MIT
| Doc PR        | ~

A regression from the bug fix #9246 was introduced due to an incomplete fix ;

As the `started` flag on the NativeSessionStorage was not `true` anymore when saving the session, the session id was always empty when saving it, and thus when sending the `PHPSESSID` cookie.

The previous PR I made (#9530) was another approach to solve this regression, but this one should keep the fix made by @tecbot on #9246, and finish it with another verification. I may miss another place where `started` is used, but I don't really see which other conditions depending on this property should be altered...

**Note : this is #9611 rebased on 2.2**

This should be mergeable.

Commits
-------

5b9a727 When getting the session's id, check if the session is not closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.