From b0b5937d1dc71ff12e1bd81b91ffe6bc67c38dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20J=C4=99drzejewski?= Date: Thu, 13 Dec 2018 14:24:29 +0100 Subject: [PATCH] Fix undefined variable in cache ArrayTrait --- src/Symfony/Component/Cache/Adapter/ArrayAdapter.php | 2 +- src/Symfony/Component/Cache/Simple/ArrayCache.php | 2 +- src/Symfony/Component/Cache/Traits/ArrayTrait.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index 47db1271b26d9..97b6b7f78088b 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -124,7 +124,7 @@ public function save(CacheItemInterface $item) return true; } - if ($this->storeSerialized && null === $value = $this->freeze($value)) { + if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) { return false; } if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { diff --git a/src/Symfony/Component/Cache/Simple/ArrayCache.php b/src/Symfony/Component/Cache/Simple/ArrayCache.php index 9185e5fa553a2..6785943787c93 100644 --- a/src/Symfony/Component/Cache/Simple/ArrayCache.php +++ b/src/Symfony/Component/Cache/Simple/ArrayCache.php @@ -129,7 +129,7 @@ public function setMultiple($values, $ttl = null) $expiry = 0 < $ttl ? microtime(true) + $ttl : PHP_INT_MAX; foreach ($valuesArray as $key => $value) { - if ($this->storeSerialized && null === $value = $this->freeze($value)) { + if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) { return false; } $this->values[$key] = $value; diff --git a/src/Symfony/Component/Cache/Traits/ArrayTrait.php b/src/Symfony/Component/Cache/Traits/ArrayTrait.php index cfa73fa7b04e5..8268e40db4140 100644 --- a/src/Symfony/Component/Cache/Traits/ArrayTrait.php +++ b/src/Symfony/Component/Cache/Traits/ArrayTrait.php @@ -113,7 +113,7 @@ private function generateItems(array $keys, $now, $f) } } - private function freeze($value) + private function freeze($value, $key) { if (null === $value) { return 'N;';