From 474712b1eb0ef5043d30d721c755c6f140ed198d Mon Sep 17 00:00:00 2001
From: Andreas Hennings <andreas@dqxtech.net>
Date: Mon, 21 Mar 2022 13:16:08 +0100
Subject: [PATCH] OEL-1281: Use local variable instead of inline evaluation in
 foreach.

---
 .../oe_whitelabel_paragraphs.install                       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install
index 5559c9cc..77b4e15f 100644
--- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install
+++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install
@@ -147,8 +147,13 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names
       // Revision not found - this is unexpected, but survivable.
       continue;
     }
+    $field_names_map = $field_names_by_bundle[$paragraph_revision->bundle()] ?? [];
+    if (!$field_names_map) {
+      // No field names to migrate - this is unexpected.
+      continue;
+    }
     $modified = FALSE;
-    foreach ($field_names_by_bundle[$paragraph_revision->bundle()] ?? [] as $dest_field_name => $source_field_name) {
+    foreach ($field_names_map as $dest_field_name => $source_field_name) {
       if ($paragraph_revision->get($source_field_name)->isEmpty()) {
         // Source field has no data.
         continue;
-- 
GitLab