8000 Broken service @session.attribute_bag using private method in factory · Issue #36465 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Broken service @session.attribute_bag using private method in factory #36465
Closed
@VincentChalnot

Description

@VincentChalnot

Symfony version(s) affected: >3.4.31

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
     */
    private function getAttributeBag()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0