Skip to content

[Cache] Cache pool with provider key can not be overriden in tests environment and failes with OutOfBoundsException #58864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sidz opened this issue Nov 13, 2024 · 1 comment

Comments

@sidz
Copy link
Contributor

sidz commented Nov 13, 2024

Symfony version(s) affected

7.1

Description

Cache clear fails on test environment when one of the cache pool uses non-default provider and defined cache pool is overridden with cache.adapter.array adapter which doesn't support provider key.

I didn't check lower versions but I think it's actual for any supported symfony version.

How to reproduce

cache.yaml

framework:
    cache:
        default_redis_provider: '%env(REDIS_DSN)%'

        pools:
            cache.my_cache:
                adapter: cache.adapter.redis
                provider: '%env(REDIS_CUSTOM_DSN)%'
                default_lifetime: '%env(LIFETIME)%'

when@test:
    framework:
        cache:
            pools:
                cache.my_cache:
                    adapter: cache.adapter.array

Run bin/console ca:cl -e test

14c7a6e7ae7c:/app# bin/console ca:cl -e test -vv

In Definition.php line 261:
                                                                                                                      
  [Symfony\Component\DependencyInjection\Exception\OutOfBoundsException]                                              
  Service "cache.my_cache": The argument "1" doesn't exist in class "Symfony\Component\Cache\Adapter\ArrayAdapter".  
                                                                                                                      

Exception trace:
  at /app/vendor/symfony/dependency-injection/Definition.php:261
 Symfony\Component\DependencyInjection\Definition->replaceArgument() at /app/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:167
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->doResolveDefinition() at /app/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:63
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->resolveDefinition() at /app/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:46
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->processValue() at /app/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:84
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /app/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:37
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->processValue() at /app/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:45
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() at /app/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /app/vendor/symfony/dependency-injection/ContainerBuilder.php:752
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /app/vendor/symfony/http-kernel/Kernel.php:495
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /app/vendor/symfony/http-kernel/Kernel.php:740
 Symfony\Component\HttpKernel\Kernel->preBoot() at /app/vendor/symfony/http-kernel/Kernel.php:120
 Symfony\Component\HttpKernel\Kernel->boot() at /app/vendor/symfony/framework-bundle/Console/Application.php:177
 Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /app/vendor/symfony/framework-bundle/Console/Application.php:69
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /app/vendor/symfony/console/Application.php:167
 Symfony\Component\Console\Application->run() at /app/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /app/vendor/autoload_runtime.php:29
 require_once() at /app/bin/console:11

Possible Solution

No response

Additional Context

No response

@sidz sidz added the Bug label Nov 13, 2024
@sidz sidz changed the title [Cache] Cache pool with provider key can not be overriden in tests environment and faies with OutOfBoundsException [Cache] Cache pool with provider key can not be overriden in tests environment and failes with OutOfBoundsException Nov 13, 2024
@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants