#107470Harden StandardContentPreviewRenderer
Description
Contrary to what the doc-block is saying, the method BackendUtility::getProcessedValue can return something different than string or null. In PHP 8.4, giving an integer value to htmlspecialchars will cause an exception.
To prevent this, the return type of the method in question must either be enforced, or the value in $fieldValue must be explicitly cast to string, before giving it to htmlspecialchars.
The problem popped up for me with gridelements sending something to the StandardContentPreviewRenderer and it checking the header_layout field, which contained integer values.
https://github.com/TYPO3/typo3/blob/13.4/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php#L268
https://github.com/TYPO3/typo3/blob/13.4/typo3/sysext/backend/Classes/Utility/BackendUtility.php#L1616
Reviews 2
History 25
-
Gerrit Code Review pushed patch set 1 for main to change 90713 status
NewUnder Review <span data-processor="relativetime" data-value="2025-09-17T18:51:39+00:00" > 09/17/25, 18:51 </span> -
Gerrit Code Review pushed patch set 2 for main to change 90713 <span data-processor="relativetime" data-value="2025-09-18T08:57:54+00:00" > 09/18/25, 08:57 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 90720 <span data-processor="relativetime" data-value="2025-09-18T20:03:57+00:00" > 09/18/25, 20:03 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-09-18T20:05:07+00:00" > 09/18/25, 20:05 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T13:04:27+00:00" > 12/02/25, 13:04 </span>
Applied in changeset commit:5419b169848a1485cff75950b0c949ce68544a73.