From eb436b19b1376859098fd705bb6963c66d315753 Mon Sep 17 00:00:00 2001
From: Patrick Broens <patrick@patrickbroens.nl>
Date: Mon, 6 Apr 2020 17:08:54 +0200
Subject: [PATCH] [BUGFIX] Fix thrown exception in history

When a logged in backend user is entering the history/undo functionality
for a certain page, which contains a deleted one, the backend user
authentication will throw an error.

This is due to the fact the pid field is not taken into account when
fetching the pages to check if they are deleted. This pid field will be
used to calculate the page access, but is now done with the value null.

This patch will add the pid field when fetching the subpages which will
be checked if they are deleted.

Resolves: #90963
Releases: master, 9.5
Change-Id: I1b78d4a71fea35b5d55a1d8989e586f01e7d9280
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64088
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 typo3/sysext/backend/Classes/History/RecordHistory.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Classes/History/RecordHistory.php b/typo3/sysext/backend/Classes/History/RecordHistory.php
index 8a82398a05cf..e93dc8014ee3 100644
--- a/typo3/sysext/backend/Classes/History/RecordHistory.php
+++ b/typo3/sysext/backend/Classes/History/RecordHistory.php
@@ -513,7 +513,8 @@ class RecordHistory
             $isDeletedPage = false;
             if (isset($GLOBALS['TCA']['pages']['ctrl']['delete'])) {
                 $deletedField = $GLOBALS['TCA']['pages']['ctrl']['delete'];
-                $pageRecord = BackendUtility::getRecord('pages', $pageId, $deletedField, '', false);
+                $fields = 'pid,' . $deletedField;
+                $pageRecord = BackendUtility::getRecord('pages', $pageId, $fields, '', false);
                 $isDeletedPage = (bool)$pageRecord[$deletedField];
             }
             if ($isDeletedPage) {
-- 
GitLab