Skip to content
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

Using HttpCache with unbooted Kernel fails #40624

Closed
alexander-schranz opened this issue Mar 29, 2021 · 3 comments
Closed

Using HttpCache with unbooted Kernel fails #40624

alexander-schranz opened this issue Mar 29, 2021 · 3 comments

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented Mar 29, 2021

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.

@xabbuh
Copy link
Member

xabbuh commented Mar 29, 2021

Same as #40618?

@alexander-schranz
Copy link
Contributor Author

@xabbuh thanks that is the same one, not sure how I could not find that one 🙈

@alexander-schranz
Copy link
Contributor Author

Tested and the #40619 seems to fix our issue. Thx for the fast response 🙏 and sorry for the additional issue!

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

3 participants