Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.3][FrameworkBundle] Allow parameter use_cookies in session configuration #13671

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

Conversation

derrabus
Copy link
Member

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

This PR adds support for the use_cookies parameter to the session configuration of Symfony's FrameworkBundle. I did not know, whether #13668 should be considered as a bug or a missing feature. For now, I based my patch on the 2.3 branch, but it can easily be rebased against 2.7.

@derrabus derrabus changed the title Allow parameter use_cookies in session configuration. [2.3][FrameworkBundle] Allow parameter use_cookies in session configuration Feb 12, 2015
@weaverryan
Copy link
Member

I can't find any reason why this was not originally implemented. I mean - I think it was just an oversight, as you mentioned in #13668.

A) Here is a blame on the fact that session.use_cookies is set to 1 - it just says it's a sensible default: 39526df#diff-ed43f01e0d282653013b89d059ee6092R91

B) And use_cookies is listed as a valid option for the class: https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L312

@derrabus does/did this patch accomplish what you needed (i.e. sessions without a cookie being set)? If so, 👍 from me.

And sorry for the delay @derrabus :)

@derrabus
Copy link
Member Author

Thanks for your answer, @weaverryan. Yes, I've tested the patch back then with our codebase and it worked. Our project currently uses the workaround I mentioned in #13668 which works as good, but future maintenance will certainly be easier if this patch gets merged.

@Tobion
Copy link
Contributor

Tobion commented Jun 24, 2015

👍 and I think it's safe to merge in 2.3. But could also be seen as a new feature.

Some options are not exposed on purpose I guess like http://php.net/manual/en/session.configuration.php#ini.session.use-trans-sid which should not be used. But disabling cookies for manual session initialization in an API seems sensible.

@derrabus you set the session id based on the HTTP header and then call session start() right to get this working?

@fabpot
Copy link
Member

fabpot commented Jun 24, 2015

It is not an oversight. I consciously did not include use_sessions in the configuration back then.

If we were to support it, it's definitely a new feature for 2.8.

@derrabus
Copy link
Member Author

@Tobion Yes, more or less like this.

$session = $request->getSession();
$sid = $this->extractSid($request->headers->get('My-Header'));
$session->setId($sid);
$session->start();

@fabpot In that case, I will rebase my patch against the 2.8 branch.

@derrabus
Copy link
Member Author

Please see #15123 for a patch against 2.8.

@fabpot fabpot closed this Jun 27, 2015
fabpot added a commit that referenced this pull request Aug 1, 2015
…session configuration (derrabus)

This PR was merged into the 2.8 branch.

Discussion
----------

[2.8][FrameworkBundle] Allow parameter use_cookies in session configuration

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

This PR adds support for the `use_cookies` parameter to the session configuration of Symfony's FrameworkBundle. It is a rebase of #13671 against the 2.8 branch.

Commits
-------

08bf50a Allow parameter use_cookies in session configuration.
@derrabus derrabus deleted the 2.3-session-without-cookies branch September 24, 2015 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants