#110439f:render.text: TypeError in getRecordType() for Extbase models mapped to tables without ctrl['type']
Description
The new `<f:render>` ViewHelper (introduced in #108868, TYPO3 14.2) throws a<br>TypeError when used with an Extbase model that is mapped to a table without a<br>record type field (`ctrl[‘type’]`) in TCA, e.g. `sys_category`:</f:render>
TypeError: TYPO3\CMS\Fluid\ViewHelpers\Render\TextViewHelper::getRecordType():
Return value must be of type ?string, int returned
Reproduce:
1. TYPO3 14.2, EXT:news (or any Extbase model mapped to sys_category or another
table without ctrl[‘type’])
2. Render in a Fluid template:
<f:render.text record=”{category}” field=“title” />
where {category} is e.g. GeorgRinger\News\Domain\Model\Category
3. TypeError is thrown.
Analysis:
In TextViewHelper::getRecordType():
$recordTypeFieldName = $dataMap->getRecordTypeColumnName();
foreach ($input->_getProperties() as $propertyName => $value) {
if ($dataMap->getColumnMap($propertyName)?->getColumnName() === $recordTypeFieldName) {
return $value;
}
}
For tables without ctrl[‘type’], getRecordTypeColumnName() returns null.
For any model property that has no ColumnMap (e.g. a property not backed by a
TCA column), the nullsafe chain `getColumnMap($propertyName)?->getColumnName()`
also evaluates to null, so `null === null` matches and the value of that
unrelated property is returned. If that value is an int (in the news Category
model this is the case), the declared return type `?string` is violated and a
TypeError is thrown. With a string property it would silently return a wrong
record type instead.
Suggested fix:
Return early when the table has no record type field:
$recordTypeFieldName = $dataMap->getRecordTypeColumnName();
if ($recordTypeFieldName === null) {
return null;
}
Additionally, the loop should skip properties without a ColumnMap to avoid
false positives, and the matched value should be cast to string.
Expected behaviour:
Extbase models of tables without a record type field should work; ‘fullType’
should simply be the table name (the calling code in extractInformation()
already handles $recordType being null/empty).
Reviews 1
Related issues 1
History 58
-
Markus Klein changed Related to #108868 <span data-processor="relativetime" data-value="2026-08-11T14:01:30+00:00" > 08/11/26, 14:01 </span>
-
Maike Kiebele changed assigned to Maike Kiebele <span data-processor="relativetime" data-value="2026-08-11T14:04:07+00:00" > 08/11/26, 14:04 </span>
-
Matthias Vogel commented <span data-processor="relativetime" data-value="2026-08-11T14:22:31+00:00" > 08/11/26, 14:22 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 95264 status
NewUnder Review <span data-processor="relativetime" data-value="2026-08-11T14:59:50+00:00" > 08/11/26, 14:59 </span> -
Gerrit Code Review pushed patch set 2 for 13.4 to change 95264 <span data-processor="relativetime" data-value="2026-08-11T15:15:35+00:00" > 08/11/26, 15:15 </span>
-
Gerrit Code Review pushed patch set 3 for 13.4 to change 95264 <span data-processor="relativetime" data-value="2026-08-11T15:16:30+00:00" > 08/11/26, 15:16 </span>
-
Matthias Vogel changed TYPO3 Version
1413 <span data-processor="relativetime" data-value="2026-08-12T06:13:48+00:00" > 08/12/26, 06:13 </span> -
Matthias Vogel commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-08-12T09:05:09+00:00" > 08/12/26, 09:05 </span>Applied in changeset commit:71924950cc9beb3ca6fb0d46062f1ba405482724.
This is only a Problem in TYPO3 13 the described condition is present in TYPO3 14.
I will provide a patch shortly