Skip to content

Commit 15cc7bb

Browse files
committed
Fix dependency on a non-existent service "security.context"
The security part is optional in the role provider class, which is why `security.token_storage` is also defined with `on-invalid=ignore`. As we have security disabled in dev env, neither security.token_storage nor security.context exists, but it still tries to replace the dependency and loses on-invalid=ignore. Then it was complaining, that the service is missing.
1 parent dad3372 commit 15cc7bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DependencyInjection/Compiler/SecurityContextPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class SecurityContextPass implements CompilerPassInterface
2323
{
2424
const ROLE_PROVIDER_SERVICE = 'fos_http_cache.user_context.role_provider';
25-
25+
2626
/**
2727
* {@inheritdoc}
2828
*/
@@ -31,8 +31,8 @@ public function process(ContainerBuilder $container)
3131
if (!$container->has(self::ROLE_PROVIDER_SERVICE)) {
3232
return;
3333
}
34-
35-
if (!$container->has('security.token_storage')) {
34+
35+
if (!$container->has('security.token_storage') && $container->has('security.context')) {
3636
$definition = $container->getDefinition(self::ROLE_PROVIDER_SERVICE);
3737
$definition->replaceArgument(0, new Reference('security.context'));
3838
}

0 commit comments

Comments
 (0)