Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] Exception because HttpCache tries to access the container #40618

Closed
@aschempp

Description

@aschempp

Symfony version(s) affected: 5.2.6

Description
The changes in #40497 can cause an exception if the container is not yet bootet. As far as I understand the HttpCache concept, the kernel SHOULD not be bootet for performance reasons if the request is in the cache. Therefore, the changes in #40497 must be wrong.

How to reproduce

Here's the exception trace we're getting in a Contao 4.11 setup. We're also using the FOSHttpCacheBundle and a custom entry point setup (not based on Symfony Flex)

PHP Fatal error:  Uncaught LogicException: Cannot retrieve the container from a non-booted kernel. in .../vendor/symfony/http-kernel/Kernel.php:307
Stack trace:
#0 .../vendor/symfony/framework-bundle/HttpCache/HttpCache.php(68): Symfony\Component\HttpKernel\Kernel->getContainer()
#1 .../vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(103): Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#2 .../web/index.php(31): Contao\ManagerBundle\HttpKernel\ContaoCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#3 {main}
  thrown in .../vendor/symfony/http-kernel/Kernel.php on line 307

Possible Solution

As the HttpCache is imho not allowed to access container parameters, the only solution I can think of is keep behaviour in Symfony 4.4 and set Request::enableHttpMethodParameterOverride(); in the entry point.

/cc @xabbuh

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions