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

Skip to content

Commit be04079

Browse files
committed
Fix php string interpolation issue with rename key ending up without {}
1 parent 03dc6f8 commit be04079

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ private function renameKeys(array $ids): array
195195
$newIds = [];
196196
$uniqueToken = bin2hex(random_bytes(10));
197197
foreach ($ids as $id) {
198+
$newId = '{'.$id.'}'.$uniqueToken;
198199
try {
199-
$ok = $this->redis->rename($id, "{$id}$uniqueToken");
200-
201-
// Only take into account if ok (aka key existed), it will be false on phpredis if it did not exist
200+
$ok = $this->redis->rename($id, $newId);
202201
if (true === $ok || ($ok instanceof Status && $ok === Status::get('OK'))) {
203-
$newIds[] = "{$id}$uniqueToken";
202+
// Only take into account if ok (key existed), will be false on phpredis if it did not exist
203+
$newIds[] = $newId;
204204
}
205205
} catch (\Predis\Response\ServerException $e) {
206206
// Silence errors when key does not exists on Predis. Otherwise re-throw exception

0 commit comments

Comments
 (0)