Task #103052
closed[BUGFIX] Prevent 503 error when field is NULL
100%
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.
- 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) TypeErrortrim() expects parameter 1 to be string, null given
This issue was automatically created from https://github.com/TYPO3/typo3/pull/478
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
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
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
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
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
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
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
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
Updated by Anonymous 10 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset fda71f80590975d03c7a7b8115a59c5f2717c299.