From: Eileen McNaughton Date: Wed, 7 Jan 2015 03:21:41 +0000 (+1300) Subject: defer to Tim's wisdom X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ef1c2283b61972326efab552f38f2f7173311114;p=civicrm-core.git defer to Tim's wisdom --- diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 273dbbfdcd..ee9e77810a 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -110,7 +110,10 @@ abstract class CRM_Core_Payment { if (empty($paymentProcessor)) { return CRM_Core_DAO::$_nullObject; } - Civi\Payment\System::singleton()->getByProcessor($paymentProcessor); + //we use two lines because we can't remove the '&singleton' without risking breakage + //of extension classes that extend this one + $object = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor); + return $object; } /** diff --git a/Civi/Payment/System.php b/Civi/Payment/System.php index 59e5eb1a94..18d66651ca 100644 --- a/Civi/Payment/System.php +++ b/Civi/Payment/System.php @@ -16,7 +16,7 @@ class System { /** * @var array cache */ - private static $cache = array(); + private $cache = array(); /** * @return \Civi\Payment\System @@ -35,8 +35,8 @@ class System { public function getByProcessor($processor) { $id = $processor['id']; - if (!isset(self::$cache[$id])) { - if (!isset(self::$cache[$id])) { + if (!isset($this->cache[$id])) { + if (!isset($this->cache[$id])) { //does this config need to be called? $config = \CRM_Core_Config::singleton(); $ext = \CRM_Extension_System::singleton()->getMapper(); @@ -52,10 +52,10 @@ class System { require_once str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php'; } - self::$cache[$id] = new $paymentClass($processor['is_test'] ? 'test' : 'live', $processor); + $this->cache[$id] = new $paymentClass($processor['is_test'] ? 'test' : 'live', $processor); } } - return self::$cache[$id]; + return $this->cache[$id]; } /** * @param integer $id