Skip to content
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

[HttpFoundation] fix accessing session bags #32137

Merged
merged 1 commit into from Jun 26, 2019
Merged

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jun 22, 2019

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

return $this->storage->getBag($name)->getBag();
$bag = $this->storage->getBag($name);

return method_exists($bag, 'getBag') ? $bag->getBag() : $bag;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not test against SessionBagProxy to make the intention clear?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, otherwise i'd prefer to deprecate the situation (calling getBag on a non-proxy bag).

But i tend to believe one relies on a bug in this case.

Copy link
Member Author

@xabbuh xabbuh Jun 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how many people out there created their own SessionBagInterface implementations and also implemented this method this method to work around this issue. IMO we should play safe here to not risk any existing application.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

@fabpot
Copy link
Member

fabpot commented Jun 26, 2019

Thank you @xabbuh.

@fabpot fabpot merged commit 7a4570d into symfony:3.4 Jun 26, 2019
fabpot added a commit that referenced this pull request Jun 26, 2019
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] fix accessing session bags

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

Commits
-------

7a4570d fix accessing session bags
@xabbuh xabbuh deleted the issue-30682 branch June 26, 2019 08:22
This was referenced Jun 26, 2019
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.

None yet

6 participants