Skip to content

Commit 5373517

Browse files
committed
Fixed compatibility issue with Symfony 5 (#21)
1 parent cc150cb commit 5373517

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Psr6Store.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,10 @@ public function write(Request $request, Response $response)
254254
// Tags
255255
$tags = [];
256256
if ($response->headers->has($this->options['cache_tags_header'])) {
257-
// Symfony < 4.4
258-
$headers = $response->headers->get($this->options['cache_tags_header'], '', false);
259-
if (\is_string($headers)) {
260-
// Symfony >= 4.4
261-
$headers = $response->headers->all($this->options['cache_tags_header']);
262-
}
257+
// Compatibility with Symfony 3+
258+
$allHeaders = $response->headers->all();
259+
$key = str_replace('_', '-', strtolower($this->options['cache_tags_header']));
260+
$headers = isset($allHeaders[$key]) ? $allHeaders[$key] : [];
263261

264262
foreach ($headers as $header) {
265263
foreach (explode(',', $header) as $tag) {

0 commit comments

Comments
 (0)