[BUGFIX] Prevent 503 error when field is NULL #478
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our editors managed to trigger a 503 error (message:
trim() expects parameter 1 to be string, null given
) in the backend page module by creatingmenu_categorized_content
objects withselected_categories
, then turning them intomenu_section
objects.Having any value set in DB for
selected_categories
is apparently enough to enterStandardContentPreviewRenderer::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
menu_categorized_content
ContentElement, and select one category inselected_categories
menu_section