You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The session.attribute_bag service is now broken because the previously magic Session::getAttributeBag method was added, quote : "to help with IDE autocompletion".
(At least that's the most reasonable explaination to me)
How to reproduce
Simply require the session.attribute_bag in any other service, it will throw the following error:
Call to private method Symfony\Component\HttpFoundation\Session\Session::getAttributeBag() from context ...'
Possible Solution
Remove service because it seems that nobody is using it apart from me?
Fix service definition with different method
Make the method public
Additional context
# From src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml:43<service id="session.attribute_bag" class="Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag"><factory service="session" method="getAttributeBag"/></service>
// From src/Symfony/Component/HttpFoundation/Session/Session.php:271/** * Gets the attributebag interface. * * Note that this method was added to help with IDE autocompletion. * * @return AttributeBagInterface */privatefunction getAttributeBag()
The text was updated successfully, but these errors were encountered:
…tion (fancyweb)
This PR was merged into the 3.4 branch.
Discussion
----------
[FrameworkBundle] Fix session.attribute_bag service definition
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #36465
| License | MIT
| Doc PR | -
It looks like in #36063, the fact the the `getAttributeBag` method is private was forgotten. It cannot be used as the factory method. I guess we can make it public. Should it maybe marked `@internal`?
Commits
-------
76072c6 [FrameworkBundle] Fix session.attribute_bag service definition
Symfony version(s) affected: >3.4.31
Description
The
session.attribute_bag
service is now broken because the previously magicSession::getAttributeBag
method was added, quote : "to help with IDE autocompletion".(At least that's the most reasonable explaination to me)
How to reproduce
Simply require the
session.attribute_bag
in any other service, it will throw the following error:Possible Solution
Additional context
The text was updated successfully, but these errors were encountered: