From fa8c05b8ba019974ae896fe2aea161a396f94f6f Mon Sep 17 00:00:00 2001 From: Paulo Iankoski Date: Tue, 23 Jan 2024 17:17:49 -0300 Subject: [PATCH] Fix: prevent fatal error during form migration (#7197) Co-authored-by: Jon Waldstein --- give.php | 4 ++-- readme.txt | 7 +++++-- src/FormMigration/FormMetaDecorator.php | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/give.php b/give.php index 0718a0a0bd..f71b473500 100644 --- a/give.php +++ b/give.php @@ -6,7 +6,7 @@ * Description: The most robust, flexible, and intuitive way to accept donations on WordPress. * Author: GiveWP * Author URI: https://givewp.com/ - * Version: 3.3.0 + * Version: 3.3.1 * Requires at least: 6.0 * Requires PHP: 7.2 * Text Domain: give @@ -403,7 +403,7 @@ private function setup_constants() { // Plugin version. if (!defined('GIVE_VERSION')) { - define('GIVE_VERSION', '3.3.0'); + define('GIVE_VERSION', '3.3.1'); } // Plugin Root File. diff --git a/readme.txt b/readme.txt index 218c44d4ec..5979fe2631 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 3.3.0 +Stable tag: 3.3.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -262,7 +262,10 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri 10. Use almost any payment gateway integration with GiveWP through our add-ons or by creating your own add-on. == Changelog == -= 3.3.0: Jan 10th, 2024 = += 3.3.1: January 23rd, 2024 = +* Fix: Resolved an issue checking for the GiveWP Funds and Designations add-on information during form migrations + += 3.3.0: January 10th, 2024 = * Happy new year! * Fix: Resolved an issue where some migrated forms were being duplicated * Fix: Resolved an issue with the donor export filter by donation form diff --git a/src/FormMigration/FormMetaDecorator.php b/src/FormMigration/FormMetaDecorator.php index 0134297697..e483e2be27 100644 --- a/src/FormMigration/FormMetaDecorator.php +++ b/src/FormMigration/FormMetaDecorator.php @@ -5,7 +5,6 @@ use Give\DonationForms\V2\Models\DonationForm; use Give\DonationForms\ValueObjects\GoalType; use Give\FormMigration\Contracts\FormModelDecorator; -use Give\Log\Log; use Give\PaymentGateways\Gateways\Stripe\StripePaymentElementGateway\StripePaymentElementGateway; use Give_Email_Notification_Util; @@ -599,23 +598,25 @@ private function getMeta(string $key, $default = null) } /** + * @since 3.3.1 changed how is checked if the form has funds * @since 3.3.0 */ public function hasFunds(): bool { $fundsAndDesignationsAttributes = $this->getFundsAndDesignationsAttributes(); - return count($fundsAndDesignationsAttributes['fund']) > 0; + return !empty($fundsAndDesignationsAttributes['fund']); } /** + * @since 3.3.1 changed how is checked if the form has fund options * @since 3.3.0 */ public function hasFundOptions(): bool { $fundsAndDesignationsAttributes = $this->getFundsAndDesignationsAttributes(); - return count($fundsAndDesignationsAttributes['options']) > 0; + return !empty($fundsAndDesignationsAttributes['options']); } /**