Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21d3d24

Browse files
committed
fix memory leak
1 parent 07a891f commit 21d3d24

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ private function generateItems(iterable $items, array &$keys): \Generator
365365
private function getId($key)
366366
{
367367
if ($this->versioningIsEnabled && '' === $this->namespaceVersion) {
368-
$this->ids = [];
369368
$this->namespaceVersion = '1'.static::NS_SEPARATOR;
370369
try {
371370
foreach ($this->doFetch([static::NS_SEPARATOR.$this->namespace]) as $v) {
@@ -379,18 +378,14 @@ private function getId($key)
379378
}
380379
}
381380

382-
if (\is_string($key) && isset($this->ids[$key])) {
383-
return $this->namespace.$this->namespaceVersion.$this->ids[$key];
384-
}
385381
\assert('' !== CacheItem::validateKey($key));
386-
$this->ids[$key] = $key;
387382

388383
if (null === $this->maxIdLength) {
389384
return $this->namespace.$this->namespaceVersion.$key;
390385
}
391386
if (\strlen($id = $this->namespace.$this->namespaceVersion.$key) > $this->maxIdLength) {
392387
// Use MD5 to favor speed over security, which is not an issue here
393-
$this->ids[$key] = $id = substr_replace(base64_encode(hash('md5', $key, true)), static::NS_SEPARATOR, -(\strlen($this->namespaceVersion) + 2));
388+
$id = substr_replace(base64_encode(hash('md5', $key, true)), static::NS_SEPARATOR, -(\strlen($this->namespaceVersion) + 2));
394389
$id = $this->namespace.$this->namespaceVersion.$id;
395390
}
396391

0 commit comments

Comments
 (0)