From e00d4bec694bd77083f282b78f1ebd8e0b653c59 Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Wed, 8 Apr 2020 13:17:49 +0200
Subject: [PATCH] [BUGFIX] Iterate over record row only if available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The row must only be processed if available.

Resolves: #90979
Releases: master
Change-Id: I0ce76b196c32d8528d0bce0467782c3da4daefba
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64099
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Christian Eßl <indy.essl@gmail.com>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Eßl <indy.essl@gmail.com>
---
 typo3/sysext/impexp/Classes/Export.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/impexp/Classes/Export.php b/typo3/sysext/impexp/Classes/Export.php
index 1d418d60e6d2..8ca7b0808c29 100644
--- a/typo3/sysext/impexp/Classes/Export.php
+++ b/typo3/sysext/impexp/Classes/Export.php
@@ -480,14 +480,14 @@ class Export extends ImportExport
             foreach ($addR as $fI) {
                 // Get and set record:
                 $row = BackendUtility::getRecord($fI['table'], $fI['id']);
-                // Depending on db driver, int fields may or may not be returned as integer or as string. The
-                // loop aligns that detail and forces strings for everything to have exports more db agnostic.
-                foreach ($row as $fieldName => $value) {
-                    // Keep null but force everything else to string
-                    $row[$fieldName] = $value === null ? $value : (string)$value;
-                }
 
                 if (is_array($row)) {
+                    // Depending on db driver, int fields may or may not be returned as integer or as string. The
+                    // loop aligns that detail and forces strings for everything to have exports more db agnostic.
+                    foreach ($row as $fieldName => $value) {
+                        // Keep null but force everything else to string
+                        $row[$fieldName] = $value === null ? $value : (string)$value;
+                    }
                     $this->export_addRecord($fI['table'], $row, $relationLevel + 1);
                 }
                 // Set status message
-- 
GitLab