Skip to content

[Cache] TagAwareAdapter not invalidating items properly since 4.4.11 #37667

Closed
@dmaicher

Description

@dmaicher

Symfony version(s) affected: 4.4.11

Description
After upgrading from 4.4.10 to 4.4.11 I noticed some failing tests on my project. After some debugging it seems that the TagAwareAdapter is not properly invalidating cache items by tag anymore.

How to reproduce
Minimal reproducing test case:

    public function testClearsCacheProperly(): void
    {
        $adapter = new \Symfony\Component\Cache\Adapter\TagAwareAdapter(
            new \Symfony\Component\Cache\Adapter\ArrayAdapter()
        );
        $item = $adapter->getItem('foo');

        $this->assertFalse($item->isHit());

        $item->tag('bar');
        $item->expiresAfter(100);
        $adapter->save($item);

        $this->assertTrue($adapter->getItem('foo')->isHit());

        $adapter->invalidateTags(['bar']);

        // this fails on 4.4.11 and passes on 4.4.10
        $this->assertFalse($adapter->getItem('foo')->isHit());
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions