8000 Merge branch '4.4' into 5.4 · symfony/cache@2e23f0f · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e23f0f

Browse files
Merge branch '4.4' into 5.4
* 4.4: [HttpKernel] Fix empty request stack when terminating with exception [HttpKernel] Remove EOL when using error_log() in HttpKernel Logger s/annd/and s/gargage/garbage [Console] Fix error output on windows cli Reserve keys when using numeric ones add missing Azerbaijani translations fix few typos/inconsistencies in latvian translations fix: use message object from event
2 parents 89bb6a0 + 3b98ed6 commit 2e23f0f

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Adapter/RedisTagAwareAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected function doInvalidate(array $tagIds): bool
208208
// and removes the linked items. When the set is still not empty after
209209
// the scan, it means we're in cluster mode and that the linked items
210210
// are on other nodes: we move the links to a temporary set and we
211-
// gargage collect that set from the client side.
211+
// garbage collect that set from the client side.
212212

213213
$lua = <<<'EOLUA'
214214
redis.replicate_commands()

Tests/Adapter/AdapterTestCase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,19 @@ public function testNullByteInKey()
341341

342342
$this->assertSame(123, $cache->getItem("a\0b")->get());
343343
}
344+
345+
public function testNumericKeysWorkAfterMemoryLeakPrevention()
346+
{
347+
$cache = $this->createCachePool(0, __FUNCTION__);
348+
349+
for ($i = 0; $i < 1001; ++$i) {
350+
$cacheItem = $cache->getItem((string) $i);
351+
$cacheItem->set('value-'.$i);
352+
$cache->save($cacheItem);
353+
}
354+
355+
$this->assertEquals('value-50', $cache->getItem((string) 50)->get());
356+
}
344357
}
345358

346359
class NotUnserializable

Traits/AbstractAdapterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ private function getId($key)
394394
$this->ids[$key] = $key;
395395

396396
if (\count($this->ids) > 1000) {
397-
array_splice($this->ids, 0, 500); // stop memory leak if there are many keys
397+
$this->ids = \array_slice($this->ids, 500, null, true); // stop memory leak if there are many keys
398398
}
399399

400400
if (null === $this->maxIdLength) {

0 commit comments

Comments
 (0)
0