Skip to content

Commit

Permalink
CRM_Core_BAO_Cache - When delegating to an adapter, don't expect it t…
Browse files Browse the repository at this point in the history
…o return a reference

This is following up on the code-review comments from
#13489 (comment)
  • Loading branch information
totten committed Feb 4, 2019
1 parent 88dfeb5 commit b5e7d57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CRM/Core/BAO/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
*/
public static function &getItem($group, $path, $componentID = NULL) {
if (($adapter = CRM_Utils_Constant::value('CIVICRM_BAO_CACHE_ADAPTER')) !== NULL) {
return $adapter::getItem($group, $path, $componentID);
$value = $adapter::getItem($group, $path, $componentID);
return $value;
}

if (self::$_cache === NULL) {
Expand Down
5 changes: 2 additions & 3 deletions CRM/Core/BAO/Cache/Psr16.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected static function getGroup($group) {
* @return object
* The data if present in cache, else null
*/
public static function &getItem($group, $path, $componentID = NULL) {
public static function getItem($group, $path, $componentID = NULL) {
// TODO: Generate a general deprecation notice.
if ($componentID) {
Civi::log()
Expand All @@ -95,8 +95,7 @@ public static function &getItem($group, $path, $componentID = NULL) {
'path' => $path,
]);
}
$value = self::getGroup($group)->get(CRM_Core_BAO_Cache::cleanKey($path));
return $value;
return self::getGroup($group)->get(CRM_Core_BAO_Cache::cleanKey($path));
}

/**
Expand Down

0 comments on commit b5e7d57

Please sign in to comment.