From 055ffa9370e4aceff3361c84475769f49dd76894 Mon Sep 17 00:00:00 2001 From: emilicastells Date: Wed, 18 Jan 2023 14:39:27 +0100 Subject: [PATCH 1/2] Ensure `WC()->payment_gateways` is not null --- modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index ad60cb9fb..bbd9b30d3 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -99,6 +99,10 @@ class DisableGateways { * @return bool */ private function disable_all_gateways() : bool { + if ( is_null( WC()->payment_gateways ) ) { + return false; + } + foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) { if ( PayPalGateway::ID === $gateway->id && $gateway->enabled !== 'yes' ) { return true; From e0d8715d0c205db0ce3dc74bbe793979b03e8dc1 Mon Sep 17 00:00:00 2001 From: emilicastells Date: Wed, 18 Jan 2023 15:06:54 +0100 Subject: [PATCH 2/2] Update changelog --- changelog.txt | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 66dc6830a..39ecc5aa1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ * Fix - Do not call PayPal get order by ID if it does not exist #1029 * Fix - Type check error conflict with German Market #1056 * Fix - Backend Storage for the PayPalRequestIdRepository does not scale #983 +* Fix - Ensure WC()->payment_gateways is not null #1128 * Enhancement - Remove plugin data after uninstalling #1075 * Enhancement - Add FraudNet to all payments #1040 * Enhancement - Update "Standard Payments" tab settings #1065 diff --git a/readme.txt b/readme.txt index eda478f81..c2a417e3e 100644 --- a/readme.txt +++ b/readme.txt @@ -85,6 +85,7 @@ Follow the steps below to connect the plugin to your PayPal account: * Fix - Do not call PayPal get order by ID if it does not exist #1029 * Fix - Type check error conflict with German Market #1056 * Fix - Backend Storage for the PayPalRequestIdRepository does not scale #983 +* Fix - Ensure WC()->payment_gateways is not null #1128 * Enhancement - Remove plugin data after uninstalling #1075 * Enhancement - Add FraudNet to all payments #1040 * Enhancement - Update "Standard Payments" tab settings #1065