Project

General

Profile

Actions

Task #103052

closed

[BUGFIX] Prevent 503 error when field is NULL

Added by TYPO3 GmbH TYPO3com 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-02-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Our editors managed to trigger 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`, then turning them into `menu_section` objects.

Having any value set in DB for `selected_categories` is apparently enough to enter `StandardContentPreviewRenderer::generateListForMenuContentTypes` .
https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php#L198 even if the CType doesn't use it.

A possible fix could be to check the right field for the right CType. But a perhaps more robust and flexible solution would be to ensure NULL values would be turned into empty strings.

  1. How to reproduce

Reproduced with TYPO3 version 11.5.34

1. On a new page, create a `menu_categorized_content` ContentElement, and select one category in `selected_categories`
2. Save
3. Update the CType to be `menu_section`
4. Save and close
5. Opening the page module for it will result in the following exception:

Whoops, looks like something went wrong.
(1/1) TypeError

trim() expects parameter 1 to be string, null given

This issue was automatically created from https://github.com/TYPO3/typo3/pull/478

Actions #1

Updated by Gerrit Code Review 10 months ago

  • Status changed from New to Under Review

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/+/82793

Actions #2

Updated by Gerrit Code Review 10 months ago

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/+/82794

Actions #3

Updated by Gerrit Code Review 10 months ago

Patch set 2 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/+/82794

Actions #4

Updated by Gerrit Code Review 10 months ago

Patch set 3 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/+/82794

Actions #5

Updated by Gerrit Code Review 10 months ago

Patch set 4 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/+/82794

Actions #6

Updated by Gerrit Code Review 10 months ago

Patch set 5 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/+/82794

Actions #7

Updated by Gerrit Code Review 10 months ago

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

Actions #8

Updated by Gerrit Code Review 10 months ago

Patch set 2 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/+/82793

Actions #9

Updated by Anonymous 10 months ago

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

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF