Skip to content

[FrameworkBundle] make resettable services configurable/opt-in on 3.4?  #24552

Closed
@dmaicher

Description

@dmaicher
Q A
Bug report? no
Feature request? yes
BC Break report? yes
RFC? yes
Symfony version 3.4

I found some issues when testing Symfony 3.4.x-dev on one of my biggest apps.

With this PR #24155 the resettable services have been introduced and it seems this is quite a behavior change for example within functional phpunit tests.

In our tests we have some cases where we use a Symfony\Bundle\FrameworkBundle\Client and perform some requests on our app. Afterwards we access the container of the client's kernel to retrieve some services that are now suddenly reset after the request 😕

I'm wondering if this new resettable stuff should be opt-in? I mean apart from my (probably not so hard to fix) test issues this will also consume CPU cycles on production where we have a normal php-fpm "shared nothing" setup like probably most people out there?

For now I would probably add this to my app:

class RemoveServiceResetListenerPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        if ($container->hasDefinition(ServiceResetListener::class)) {
            $container->removeDefinition(ServiceResetListener::class);
        }
    }
}

What do you think?

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