diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 00892d8847951..164847e986daa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -392,7 +392,7 @@ public function load(array $configs, ContainerBuilder $container) $propertyInfoEnabled = $this->isConfigEnabled($container, $config['property_info']); $this->registerValidationConfiguration($config['validation'], $container, $loader, $propertyInfoEnabled); - $this->registerHttpCacheConfiguration($config['http_cache'], $container); + $this->registerHttpCacheConfiguration($config['http_cache'], $container, $config['http_method_override']); $this->registerEsiConfiguration($config['esi'], $container, $loader); $this->registerSsiConfiguration($config['ssi'], $container, $loader); $this->registerFragmentsConfiguration($config['fragments'], $container, $loader); @@ -580,7 +580,7 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont } } - private function registerHttpCacheConfiguration(array $config, ContainerBuilder $container) + private function registerHttpCacheConfiguration(array $config, ContainerBuilder $container, bool $httpMethodOverride) { $options = $config; unset($options['enabled']); @@ -592,6 +592,13 @@ private function registerHttpCacheConfiguration(array $config, ContainerBuilder $container->getDefinition('http_cache') ->setPublic($config['enabled']) ->replaceArgument(3, $options); + + if ($httpMethodOverride) { + $container->getDefinition('http_cache') + ->addArgument((new Definition('void')) + ->setFactory([Request::class, 'enableHttpMethodParameterOverride']) + ); + } } private function registerEsiConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader) diff --git a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php index 45b2ca785603e..35ea73c235771 100644 --- a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php +++ b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php @@ -18,7 +18,6 @@ use Symfony\Component\HttpKernel\HttpCache\Store; use Symfony\Component\HttpKernel\HttpCache\StoreInterface; use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelInterface; /** @@ -63,15 +62,6 @@ public function __construct(KernelInterface $kernel, $cache = null, SurrogateInt parent::__construct($kernel, $this->createStore(), $this->createSurrogate(), array_merge($this->options, $this->getOptions())); } - public function handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true) - { - if ($this->kernel->getContainer()->getParameter('kernel.http_method_override')) { - Request::enableHttpMethodParameterOverride(); - } - - return parent::handle($request, $type, $catch); - } - /** * {@inheritdoc} */
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: