Project

General

Profile

Actions

Bug #97146

closed

Undefined array key "uid" in ContentContentObject

Added by Georg Tiefenbrunn over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-03-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

ContentContentObject::render() can't handle 'records' without uid:

# TypoScript
page.10 = CONTENT
page.10 {
  table = tt_content
  select.selectFields = count(*)
  renderObj = TEXT
  renderObj {
    field = count(*)
    wrap = value:|
  }
}
PHP Warning: Undefined array key "uid" in typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php line 91

According to https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/Functions/Select.html#selectfields select.selectFields = count(*) is valid TypoScript:

List of fields to select, or count(*).

TypoScript workaround

page.10 = CONTENT
page.10 {
  table = tt_content
  select.selectFields = count(uid) AS count, uid
  renderObj = TEXT
  renderObj {
    value = {field:count}
    insertData = 1
    wrap = value:|
  }
}

Fix

// typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php line 91
-                    $registerField = $conf['table'] . ':' . $row['uid'];
+                    $registerField = $conf['table'] . ':' . (int)($row['uid'] ?? 0);
Actions #1

Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73860

Actions #2

Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73872

Actions #3

Updated by Georg Ringer over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF