Skip to content

Commit 90a28a1

Browse files
committed
Fixed an issue with tags not properly reinitialized when a backend driver returns an expired cache item
1 parent 714b62d commit 90a28a1

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lib/Phpfastcache/Core/Item/TaggableCacheItemTrait.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ public function hasTags(array $tagNames, int $strategy = TaggableCacheItemInterf
9090
*/
9191
public function setTags(array $tags): ExtendedCacheItemInterface
9292
{
93-
if (\count($tags)) {
94-
if (\array_filter($tags, 'is_string')) {
95-
$this->tags = $tags;
96-
} else {
97-
throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string');
98-
}
93+
if ($tags === [] || \array_filter($tags, 'is_string')) {
94+
$this->tags = $tags;
95+
} else {
96+
throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string');
9997
}
10098

10199
return $this;

0 commit comments

Comments
 (0)