Skip to content

Commit

Permalink
[BUGFIX] Prevent undefined array key in ext lowlevel
Browse files Browse the repository at this point in the history
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/+/78301
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
Tobias Gaertner authored and lolli42 committed Mar 28, 2023
1 parent 1cc57b1 commit cf6d418
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ protected function findAllFlaggedRecordsInPage(int $pageId, int $depth, int $max
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'];
}
}
Expand Down Expand Up @@ -266,7 +266,7 @@ protected function findAllFlaggedRecordsInPage(int $pageId, int $depth, int $max
) ?: [];
if (is_array($versions)) {
foreach ($versions as $verRec) {
if (!$verRec['_CURRENT_VERSION']) {
if (!($verRec['_CURRENT_VERSION'] ?? false)) {
$deletedRecords = $this->findAllFlaggedRecordsInPage($verRec['uid'], $depth, $maximumTimestamp, $deletedRecords);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected function findAllConnectedRecordsInPage(int $pageId, int $depth, array
$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'];
}
}
Expand Down Expand Up @@ -219,7 +219,7 @@ protected function findAllConnectedRecordsInPage(int $pageId, int $depth, array
$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);
}
}
Expand Down

0 comments on commit cf6d418

Please sign in to comment.