From 4841e04d858b7f87a0156cac3428fc3c32fb9f2b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 29 Mar 2018 18:14:48 -0700 Subject: [PATCH] (dev/core#177) Redis::get() should return NULL for undefined cache keys The docs for `CRM_Utils_Cache_Interface::get()` specify that the return value should be NULL if the key does not exist. However, `CRM_Utils_Cache_Redis::get()` was returning FALSE in that circumstance (because `unserialize(FALSE)===FALSE`). This fixes it comply. --- CRM/Utils/Cache/Redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Utils/Cache/Redis.php b/CRM/Utils/Cache/Redis.php index 07279d530d..5dddf91d53 100644 --- a/CRM/Utils/Cache/Redis.php +++ b/CRM/Utils/Cache/Redis.php @@ -130,7 +130,7 @@ class CRM_Utils_Cache_Redis implements CRM_Utils_Cache_Interface { */ public function get($key) { $result = $this->_cache->get($this->_prefix . $key); - return unserialize($result); + return ($result === FALSE) ? NULL : unserialize($result); } /** -- 2.25.1