From 86b6ca5ed21a8e0fe9cf1726f1df7be74283629c Mon Sep 17 00:00:00 2001
From: eileen <emcnaughton@wikimedia.org>
Date: Sun, 24 Dec 2017 08:29:00 +1300
Subject: [PATCH] CRM-21595 re-fix CRM-21445

Signed-off-by: Kevin Cristiano <kcristiano@tadpole.cc>
---
 civicrm/CRM/Contribute/Form/ContributionBase.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/civicrm/CRM/Contribute/Form/ContributionBase.php b/civicrm/CRM/Contribute/Form/ContributionBase.php
index 933128ea32..725ba42c40 100644
--- a/civicrm/CRM/Contribute/Form/ContributionBase.php
+++ b/civicrm/CRM/Contribute/Form/ContributionBase.php
@@ -294,9 +294,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
     $this->_fields = $this->get('fields');
     $this->_bltID = $this->get('bltID');
     $this->_paymentProcessor = $this->get('paymentProcessor');
-    if (!$this->_paymentProcessor) {
-      $this->_paymentProcessor = array('object' => Civi\Payment\System::singleton()->getById(0));
-    }
+
     $this->_priceSetId = $this->get('priceSetId');
     $this->_priceSet = $this->get('priceSet');
 
@@ -581,9 +579,10 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
 
     // The concept of contributeMode is deprecated.
     // The payment processor object can provide info about the fields it shows.
-    if ($isMonetary) {
+    if ($isMonetary && is_a($this->_paymentProcessor['object'], 'CRM_Core_Payment')) {
       /** @var  $paymentProcessorObject \CRM_Core_Payment */
       $paymentProcessorObject = $this->_paymentProcessor['object'];
+
       $paymentFields = $paymentProcessorObject->getPaymentFormFields();
       foreach ($paymentFields as $index => $paymentField) {
         if (!isset($this->_params[$paymentField])) {
-- 
GitLab