Skip to content

Commit c0a3f94

Browse files
committed
Fix: UserContextListener set http method wrong
1 parent de883f0 commit c0a3f94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SymfonyCache/UserContextSubscriber.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ public function preHandle(CacheEvent $event)
104104
return;
105105
}
106106

107-
if ($request->isMethodSafe()) {
107+
// We must not call $request->isMethodSafe() here, because this will mess up with later configuration of the `http_method_override` that is set onto the request by the Symfony FrameworkBundle.
108+
// See http://symfony.com/doc/current/reference/configuration/framework.html#configuration-framework-http-method-override
109+
if (in_array($request->getRealMethod(), ['GET', 'HEAD', 'OPTIONS', 'TRACE'])) {
108110
$request->headers->set($this->options['user_hash_header'], $this->getUserHash($event->getKernel(), $request));
109111
}
110112
}

0 commit comments

Comments
 (0)