From 84801709be8ad63350136fe620c82b1f9609402e Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 3 Aug 2020 10:05:02 +1200 Subject: [PATCH] Fix PaypalIPN single function to not receive-by-reference The function is called from 2 places - main - recur In both cases it is at the end of the function & so the vars, if altered, are not used again. In the case of main they are internal to the function whereas for recur they are not returned to the calling function --- CRM/Core/Payment/PayPalIPN.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index d675ab047b8c..b6948ddbd47b 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -229,8 +229,10 @@ public function recur($input, $ids, $objects, $first) { * @param bool $first * * @return void + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE) { + public function single($input, $ids, $objects, $recur = FALSE, $first = FALSE) { $contribution = &$objects['contribution']; // make sure the invoice is valid and matches what we have in the contribution record @@ -257,7 +259,7 @@ public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE } $status = $input['paymentStatus']; - if ($status == 'Denied' || $status == 'Failed' || $status == 'Voided') { + if ($status === 'Denied' || $status === 'Failed' || $status === 'Voided') { $this->failed($objects); return; } @@ -265,7 +267,7 @@ public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE Civi::log()->debug('Returning since contribution status is Pending'); return; } - elseif ($status == 'Refunded' || $status == 'Reversed') { + elseif ($status === 'Refunded' || $status === 'Reversed') { $this->cancelled($objects); return; } @@ -369,7 +371,7 @@ public function main() { return; } } - $this->single($input, $ids, $objects, FALSE, FALSE); + $this->single($input, $ids, $objects); } /**