Skip to content
Snippets Groups Projects
Commit 09a8aa23 authored by Yann's avatar Yann Committed by Stefan Bürk
Browse files

[BUGFIX] Mitigate a TypeError in `StandardContentPreviewRenderer`

An editor can trigger a TypeError exception leading to a 503 error
message `trim() expects parameter 1 to be string, null given` in
the backend page module by creating `menu_categorized_content`
objects with `selected_categories` and then turning them into
`menu_section` objects.

This change mitigates the type error by using a null-coalesce
fallback passing an invalid type to the `trim()` method in
`StandardContentPreviewRenderer::generateListForMenuContentTypes()`.

Resolves: #103052
Releases: main, 12.4, 11.5
Change-Id: I4c0ecbd20c7cdfee22fa324f6b80391be47a1b88
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82845


Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
parent 314796a0
Branches
Tags
No related merge requests found
......@@ -335,7 +335,7 @@ class StandardContentPreviewRenderer implements PreviewRendererInterface, Logger
$table = 'sys_category';
$field = 'selected_categories';
}
if (trim($record[$field]) === '') {
if (trim($record[$field] ?? '') === '') {
return '';
}
$content = '';
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment