Skip to content

Commit 1d58ee6

Browse files
committed
Fixed an issue with tags not properly reinitialized when a backend driver returns an expired cache item
1 parent 42ddab0 commit 1d58ee6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/Phpfastcache/Core/Item/TaggableCacheItemTrait.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,10 @@ public function addTag(string $tagName): ExtendedCacheItemInterface
6363
*/
6464
public function setTags(array $tags): ExtendedCacheItemInterface
6565
{
66-
if (\count($tags)) {
67-
if (\array_filter($tags, 'is_string')) {
68-
$this->tags = $tags;
69-
} else {
70-
throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string');
71-
}
66+
if ($tags === [] || \array_filter($tags, 'is_string')) {
67+
$this->tags = $tags;
68+
} else {
69+
throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string');
7270
}
7371

7472
return $this;

0 commit comments

Comments
 (0)