From e78f1e74fea882d964e197e133eb0f7a04104d9d Mon Sep 17 00:00:00 2001 From: Tobias Gaertner <noreply@example.com> Date: Tue, 28 Mar 2023 10:55:58 +0000 Subject: [PATCH] [BUGFIX] Prevent undefined array key in ext lowlevel There are several checks related to array key '_CURRENT_VERSION' on versioned records. Since PHP 8 those checks are not safe anymore and can result in errors. Releases: main, 11.5 Resolves: #100336 Change-Id: I8b5a956a987a3d8c9690e824e0fccfd6570e0069 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78306 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php | 4 ++-- .../sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php b/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php index e764f1884563..8ab0a9490a24 100644 --- a/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php +++ b/typo3/sysext/lowlevel/Classes/Command/DeletedRecordsCommand.php @@ -214,7 +214,7 @@ class DeletedRecordsCommand extends Command if (is_array($versions)) { foreach ($versions as $verRec) { // Mark as deleted - if (!$verRec['_CURRENT_VERSION'] && $verRec[$deletedField]) { + if (!($verRec['_CURRENT_VERSION'] ?? false) && $verRec[$deletedField]) { $deletedRecords[$tableName][$verRec['uid']] = $verRec['uid']; } } @@ -250,7 +250,7 @@ class DeletedRecordsCommand extends Command ) ?: []; if (is_array($versions)) { foreach ($versions as $verRec) { - if (!$verRec['_CURRENT_VERSION']) { + if (!($verRec['_CURRENT_VERSION'] ?? false)) { $deletedRecords = $this->findAllFlaggedRecordsInPage($verRec['uid'], $depth, $deletedRecords); } } diff --git a/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php b/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php index 901de19931a4..ce85728501e8 100644 --- a/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php +++ b/typo3/sysext/lowlevel/Classes/Command/OrphanRecordsCommand.php @@ -191,7 +191,7 @@ Manual repair suggestions: $versions = BackendUtility::selectVersionsOfRecord($tableName, $rowSub['uid'], 'uid,t3ver_wsid', null, true); if (is_array($versions)) { foreach ($versions as $verRec) { - if (!$verRec['_CURRENT_VERSION']) { + if (!($verRec['_CURRENT_VERSION'] ?? false)) { $allRecords[$tableName][$verRec['uid']] = $verRec['uid']; } } @@ -229,7 +229,7 @@ Manual repair suggestions: $versions = BackendUtility::selectVersionsOfRecord('pages', $pageId, 'uid,t3ver_oid,t3ver_wsid', null, true); if (is_array($versions)) { foreach ($versions as $verRec) { - if (!$verRec['_CURRENT_VERSION']) { + if (!($verRec['_CURRENT_VERSION'] ?? false)) { $allRecords = $this->findAllConnectedRecordsInPage((int)$verRec['uid'], $depth, $allRecords); } } -- GitLab