Skip to content

Commit e528b0f

Browse files
authored
Merge pull request #379 from blankse/http_method_wrong_1_4
Fix: UserContextListener set http method wrong
2 parents 23c6639 + c0a3f94 commit e528b0f

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)