Closed
Description
Symfony version(s) affected
6.4.4
Description
A bit similar to #53825
As in the code below, there is fetching several keys with mget
. Keys are already exists in database. First fetch of keys with mget
retrieves them all and create good $bufferedItems
.
But after that getTagVersion
gets wrong tag (screenshot) and unseting them all (TagAwareAdapter.php:191). This bad tag have been stored by this adapter.
And after unset them all it creates items with hit: false.
How to reproduce
$cache = new TagAwareAdapter(
new ChainAdapter(
[
new ArrayAdapter(300, false, 300),
new RedisTagAwareAdapter(
$this->redisConnectionPoolService->getClientByPoolName('cache'),
'redis.tag.aware.symfony1',
86400,
new DefaultMarshaller(false),
),
],
300,
),
);
$keys = ['key1', 'key2', 'key3'];
$tag = 'some_tag';
$notHitItems = [];
$items = $cache->getItems($keys);
foreach ($items as $item) {
if (! $item->isHit() || ! is_array($item->get())) {
$notHitItems[] = $item;
}
}
foreach ($notHitItems as $item) {
$item->set(['some_value']);
$item->expiresAfter(3 * 24 * 60 * 60);
$item->tag($tag);
$cache->saveDeferred($item);
}
if (! empty($notHitItems)) {
$cache->commit();
}
Possible Solution
No response
Additional Context
Chain adapter is not really needed here. But this is my production setup.
Seems kinda critical imho