Skip to content

Commit d1c761c

Browse files
committed
Merge branch 'hotfix/1.1.2'
2 parents 02c4275 + 70dcd5d commit d1c761c

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ return PhpCsFixer\Config::create()
3535
'psr4' => true,
3636
'strict_comparison' => true,
3737
'strict_param' => true,
38+
'native_function_invocation' => ['include' => ['@compiler_optimized']],
3839
)
3940
)
4041
->setFinder(

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"symfony/options-resolver": "^3.0|^4.0"
1919
},
2020
"require-dev": {
21-
"friendsofphp/php-cs-fixer": "^2.6",
21+
"friendsofphp/php-cs-fixer": "^2.12",
2222
"phpunit/phpunit": "^5.7.27",
2323
"php-coveralls/php-coveralls": "^2.1"
2424
},

src/Psr6Store.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ public function write(Request $request, Response $response)
231231
// Tags
232232
$tags = [];
233233
if ($response->headers->has($this->options['cache_tags_header'])) {
234-
$tags = explode(',', $response->headers->get($this->options['cache_tags_header']));
234+
foreach ($response->headers->get($this->options['cache_tags_header'], '', false) as $header) {
235+
foreach (explode(',', $header) as $tag) {
236+
$tags[] = $tag;
237+
}
238+
}
235239
}
236240

237241
// Prune expired entries on file system if needed

tests/Psr6StoreTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Symfony\Component\HttpFoundation\Response;
2323
use Symfony\Component\Lock\Exception\LockReleasingException;
2424
use Symfony\Component\Lock\Factory;
25-
use Symfony\Component\Lock\Lock;
2625
use Symfony\Component\Lock\LockInterface;
2726
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
2827

@@ -231,6 +230,21 @@ public function testWriteAddsTags()
231230
$this->assertFalse($this->getCache()->getItem($cacheKey)->isHit());
232231
}
233232

233+
public function testWriteAddsTagsWithMultipleHeaders()
234+
{
235+
$request = Request::create('/');
236+
$response = new Response('hello world', 200);
237+
$response->headers->set('Cache-Tags', ['foobar,other tag', 'some,more', 'tags', 'split,over', 'multiple-headers']);
238+
239+
$cacheKey = $this->store->getCacheKey($request);
240+
241+
$this->store->write($request, $response);
242+
243+
$this->assertTrue($this->getCache()->getItem($cacheKey)->isHit());
244+
$this->assertTrue($this->store->invalidateTags(['multiple-headers']));
245+
$this->assertFalse($this->getCache()->getItem($cacheKey)->isHit());
246+
}
247+
234248
public function testInvalidateTagsThrowsExceptionIfWrongCacheAdapterProvided()
235249
{
236250
$this->expectException(\RuntimeException::class);

0 commit comments

Comments
 (0)