Skip to content

Invalid ProfilerController Service definition #1461

@stlrnz

Description

@stlrnz

After updating my application to DoctrineBundle 2.5.4 the app fails loading with the following exception:

Doctrine\Bundle\DoctrineBundle\Controller\ProfilerController::__construct(): Argument 3 ($profiler) must be of type Symfony\Component\HttpKernel\Profiler\Profiler, null given, called in ...\var\cache\dev\Container44w2B3v\App_KernelDevDebugContainer.php on line 631

All versions before (even 2.5.3) are working as expected.
I found out that you fixed a linter error with the same error message in version 2.5.4 ( #1457 and #1459).

The context:
In my application I use a compiler pass to collect all controllers and pass them to a custom service:

final class MyCompilerPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container): void
    {
        $controllers = array_keys($container->findTaggedServiceIds('controller.service_arguments'));
        $controllerReferences = [];

        foreach ($controllers as $controller) {
            $controllerReferences[$controller] = new Reference($controller);
        }

        $definition = $container->getDefinition('my.service');
        $definition->setArgument('$controllerList', $controllerReferences);
    }
}

Inside the service I performe some business logic (details are not relevant here).
After updating the DoctrineBundle to 2.5.4 the ProfilerController seems not to able to getting loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions