From 09a8aa2344e0edace9b687d47fcdcbccc05057ea Mon Sep 17 00:00:00 2001 From: Yann <noreply@example.com> Date: Mon, 5 Feb 2024 14:53:00 +0000 Subject: [PATCH] [BUGFIX] Mitigate a TypeError in `StandardContentPreviewRenderer` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> --- .../backend/Classes/Preview/StandardContentPreviewRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php b/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php index e250c3e7ec9a..c07a3017bd7c 100644 --- a/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php +++ b/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php @@ -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 = ''; -- GitLab