From e0f29b28c437b9e490a81091360bf21ea24f46f2 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 29 Mar 2018 17:11:29 -0700 Subject: [PATCH 1/2] (dev/core#178) Redis - Report error messages --- 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 07279d530de..768588f6060 100644 --- a/CRM/Utils/Cache/Redis.php +++ b/CRM/Utils/Cache/Redis.php @@ -117,7 +117,7 @@ public function __construct($config) { */ public function set($key, &$value) { if (!$this->_cache->set($this->_prefix . $key, serialize($value), $this->_timeout)) { - CRM_Core_Error::fatal("Redis set failed, wondering why?, $key", $value); + CRM_Core_Error::fatal("Redis set ($key) failed: " . $this->_cache->getLastError(), $value); return FALSE; } return TRUE; From aed6cc223c1574bf424b666d4ba8a3bcf65086c5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 14 Jun 2018 00:53:59 -0700 Subject: [PATCH 2/2] (dev/core#178) Redis - Be a little more conservative about sharing error info --- CRM/Utils/Cache/Redis.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Cache/Redis.php b/CRM/Utils/Cache/Redis.php index 768588f6060..4c6259a7fdc 100644 --- a/CRM/Utils/Cache/Redis.php +++ b/CRM/Utils/Cache/Redis.php @@ -117,7 +117,13 @@ public function __construct($config) { */ public function set($key, &$value) { if (!$this->_cache->set($this->_prefix . $key, serialize($value), $this->_timeout)) { - CRM_Core_Error::fatal("Redis set ($key) failed: " . $this->_cache->getLastError(), $value); + if (PHP_SAPI === 'cli' || (Civi\Core\Container::isContainerBooted() && CRM_Core_Permission::check('view debug output'))) { + CRM_Core_Error::fatal("Redis set ($key) failed: " . $this->_cache->getLastError()); + } + else { + Civi::log()->error("Redis set ($key) failed: " . $this->_cache->getLastError()); + CRM_Core_Error::fatal("Redis set ($key) failed"); + } return FALSE; } return TRUE;