Skip to content

Commit

Permalink
Merge pull request #11135 from GinkgoFJG/CRM-21300-joomla-perms-notices
Browse files Browse the repository at this point in the history
CRM-21300: Addressed notices due to unexpected NULL from Joomla DB object.
  • Loading branch information
totten authored Oct 17, 2017
2 parents ab5e6a6 + 76d556c commit 8ca9fa9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CRM/Core/Permission/Joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 8ca9fa9

Please sign in to comment.