diff --git a/src/Storage/Adapter/Filesystem.php b/src/Storage/Adapter/Filesystem.php index db529dda1..98aae5151 100644 --- a/src/Storage/Adapter/Filesystem.php +++ b/src/Storage/Adapter/Filesystem.php @@ -327,7 +327,7 @@ public function setTags($key, array $tags) $filespec = $this->getFileSpec($key); if (! $tags) { - $this->unlink($this->formatTagFilename($filespac)); + $this->unlink($this->formatTagFilename($filespec)); return true; } diff --git a/test/Storage/Adapter/FilesystemTest.php b/test/Storage/Adapter/FilesystemTest.php index b0693ab54..602ae7123 100644 --- a/test/Storage/Adapter/FilesystemTest.php +++ b/test/Storage/Adapter/FilesystemTest.php @@ -608,4 +608,15 @@ public function testTagSuffixIsMutable() $this->_options->setTagSuffix('.cache'); $this->assertSame('.cache', $this->_options->getTagSuffix()); } + + public function testEmptyTagsArrayClearsTags() + { + $key = 'key'; + $tags = ['tag1', 'tag2', 'tag3']; + $this->assertTrue($this->_storage->setItem($key, 100)); + $this->assertTrue($this->_storage->setTags($key, $tags)); + $this->assertNotEmpty($this->_storage->getTags($key)); + $this->assertTrue($this->_storage->setTags($key, [])); + $this->assertEmpty($this->_storage->getTags($key)); + } }