Description
Symfony version(s) affected: 5.2.6
Description
Since the changes of #40497 (/cc @xabbuh) the HttpCache fails as the container is accessed inside the HttpCache
class. This can only be done when the kernel is booted, which we in @sulu want to avoid when the HttpCache
is used.
How to reproduce
git clone git@github.com:sulu/skeleton.git
cd skeleton
Add following to your .env.local
file:
APP_ENV=prod
DATABASE_URL=mysql://root:@127.0.0.1:3306/su_develop?serverVersion=5.7
bin/console sulu:build dev # optional error should appear before
Start webserver.
Visit the homepage:
Fatal error: Uncaught LogicException: Cannot retrieve the container from a non-booted kernel. in /Sulu-cms/sulu-develop.localhost/vendor/symfony/http-kernel/Kernel.php:307 Stack trace: #0 /sulu-cms/sulu-develop.localhost/vendor/symfony/framework-bundle/HttpCache/HttpCache.php(68): Symfony\Component\HttpKernel\Kernel->getContainer() #1 /sulu-cms/sulu-develop.localhost/vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(103): Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #2 /sulu-cms/sulu-develop.localhost/public/index.php(66): Sulu\Bundle\HttpCacheBundle\Cache\SuluHttpCache->handle(Object(Symfony\Component\HttpFoundation\Request)) #3 {main} thrown in /Users/sulu-cms/sulu-develop.localhost/vendor/symfony/http-kernel/Kernel.php on line 307
Possible Solution
The container
should not be accessed as the Kernel could not be booted yet.
Additional context
The @sulu CMS does not use the framework.http_cache
option it use the HttpCache without a bootet Kernel.