From 366f8bf875e992a66139315cd43d99947fbf00b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20J=2E=20G=C3=B3mez?= Date: Fri, 13 Oct 2017 08:21:45 -0400 Subject: [PATCH] CRM-21300: Addressed notices due to unexpected NULL from Joomla DB object. --- CRM/Core/Permission/Joomla.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Permission/Joomla.php b/CRM/Core/Permission/Joomla.php index 090d30ab36e3..17a768770bf2 100644 --- a/CRM/Core/Permission/Joomla.php +++ b/CRM/Core/Permission/Joomla.php @@ -181,8 +181,9 @@ private function getUserGroupPermsAssociations() { $db->setQuery($query); - // Load the result as a stdClass object, decoding JSON on the way - return json_decode($db->loadObject()->rules); + // Joomla gotcha: loadObject returns NULL in the case of no matches. + $result = $db->loadObject(); + return $result ? json_decode($result->rules) : (object) array(); } /**