From 8edaf249b849efae98962ea4fffa44bfa5d44377 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Fri, 24 Mar 2023 14:49:29 +0000 Subject: [PATCH 1/2] make $feed param in DataHelper::fetchValue optional --- src/helpers/DataHelper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/DataHelper.php b/src/helpers/DataHelper.php index 0c780f9c..900fc2b1 100644 --- a/src/helpers/DataHelper.php +++ b/src/helpers/DataHelper.php @@ -110,10 +110,10 @@ public static function fetchDefaultArrayValue($fieldInfo) /** * @param $feedData * @param $fieldInfo - * @param array|FeedModel $feed + * @param array|FeedModel|null $feed * @return array|ArrayAccess|mixed|null */ - public static function fetchValue($feedData, $fieldInfo, $feed) + public static function fetchValue($feedData, $fieldInfo, $feed = null) { // $feed will be a FeedModel when calling `fetchValue` from an element if ($feed instanceof FeedModel) { @@ -168,7 +168,7 @@ public static function fetchValue($feedData, $fieldInfo, $feed) } // If setEmptyValues is enabled allow overwriting existing data - if ($value === "" && $feed['setEmptyValues']) { + if ($feed !== null && $value === "" && $feed['setEmptyValues']) { return $value; } From af2a3017d11064db3af6e928e9cd219c1d7425fc Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Fri, 24 Mar 2023 12:06:53 -0700 Subject: [PATCH 2/2] changelog for https://github.com/craftcms/feed-me/pull/1265 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d26d106..cf5668f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Feed Me 4.x +## Unreleased + +- Fixed a PHP error that could occur when importing into some 3rd party fields. ([#1264](https://github.com/craftcms/feed-me/issues/1264), [#1265](https://github.com/craftcms/feed-me/pull/1265)) + ## 4.6.1 - 2023-03-20 - Fixed a JavaScript error that would occur on case-sensitive filesystems when using Feed Me. ([#1260](https://github.com/craftcms/feed-me/pull/1260), [#1257](https://github.com/craftcms/feed-me/issues/1257), [#1258](https://github.com/craftcms/feed-me/issues/1258), [#1259](https://github.com/craftcms/feed-me/issues/1259))