Closed
Description
Symfony version(s) affected: *
Description
Component symfony/cache generates cache item ID longer then maxIdLength when versioning is enabled
How to reproduce
Set maxIdLength to 255 provide namespace value with length 231. Enable versioning
class MyAdapter extends AbstractAdapter {
private $maxIdLength = 255;
}
$adapter = new MyAdapter(str_repeat('-', 231));
$adapter->enableVersioning(true);
....
$adapter->set(....);
$adapter->save();
// And now we have cache item ID length more then 255 symbols ($maxIdLength + $namespaceVersion)
Possible Solution
\Symfony\Component\Cache\Traits\AbstractTrait::getId()
~265 $this->ids[$key] = $id = substr_replace(base64_encode(hash('md5', $key, true)), ':', - (strlen($this->namespaceVersion) + 2));