From d486e1ca9e5b84b50de53c6136c11f24fb7baddd Mon Sep 17 00:00:00 2001 From: Benjamin Stout Date: Tue, 19 Feb 2019 16:32:25 -0800 Subject: [PATCH 1/3] Wrap index reference in empty() check - closes cakephp#13001 --- lib/Cake/Cache/Engine/RedisEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Cache/Engine/RedisEngine.php b/lib/Cake/Cache/Engine/RedisEngine.php index 02d677b25..f66021fce 100644 --- a/lib/Cake/Cache/Engine/RedisEngine.php +++ b/lib/Cake/Cache/Engine/RedisEngine.php @@ -228,7 +228,7 @@ class RedisEngine extends CacheEngine { * Disconnects from the redis server */ public function __destruct() { - if (!$this->settings['persistent']) { + if (empty($this->settings['persistent'])) { $this->_Redis->close(); } } From 0cc3509b74b5ef6e5629237c4ca2e4027355e184 Mon Sep 17 00:00:00 2001 From: Benjamin Stout Date: Tue, 19 Feb 2019 18:21:44 -0800 Subject: [PATCH 2/3] Prevent attempting to close an uninitialized Redis instance (issue #13001) --- lib/Cake/Cache/Engine/RedisEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Cache/Engine/RedisEngine.php b/lib/Cake/Cache/Engine/RedisEngine.php index f66021fce..fb4f9c463 100644 --- a/lib/Cake/Cache/Engine/RedisEngine.php +++ b/lib/Cake/Cache/Engine/RedisEngine.php @@ -228,7 +228,7 @@ class RedisEngine extends CacheEngine { * Disconnects from the redis server */ public function __destruct() { - if (empty($this->settings['persistent'])) { + if (empty($this->settings['persistent']) && !is_null($this->_Redis)) { $this->_Redis->close(); } } From 71f5133a8669e20ea2112f8d804c28907cdd0f07 Mon Sep 17 00:00:00 2001 From: Benjamin Stout Date: Thu, 21 Feb 2019 11:44:38 -0800 Subject: [PATCH 3/3] Use strict comparison instead of function call - #13001 --- lib/Cake/Cache/Engine/RedisEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Cache/Engine/RedisEngine.php b/lib/Cake/Cache/Engine/RedisEngine.php index fb4f9c463..6dd659944 100644 --- a/lib/Cake/Cache/Engine/RedisEngine.php +++ b/lib/Cake/Cache/Engine/RedisEngine.php @@ -228,7 +228,7 @@ class RedisEngine extends CacheEngine { * Disconnects from the redis server */ public function __destruct() { - if (empty($this->settings['persistent']) && !is_null($this->_Redis)) { + if (empty($this->settings['persistent']) && $this->_Redis !== null) { $this->_Redis->close(); } }