#102392YouTubeRenderer breaks on boolen html attribute without value
Description
Error message:
`PHP Runtime Deprecation Notice: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/vendor/typo3/cms-core/Classes/Resource/Rendering/YouTubeRenderer.php line 236`
Example code:
<f:media class="video-embed-item" file="{file}" alt="{file.alternative}" title="{file.title}"
additionalAttributes="{playsinline:null, poster: posterimage}"/>
The playsinline attribute is without value thus causing the YouTubeRenderer to fail on evaulating.
IMHO it should be supported to handle the value = null
One could argue, that we should set playsinline to true, which then only sets the attribute name, but for the poster attribute in this case we would have to evaluate the posterimage object each time which can be annoying and expanding the code unnecessarily
Reviews 3
Related issues 1
Files 1
History 37
-
Gerrit Code Review pushed patch set 1 for main to change 81763 status
NewUnder Review <span data-processor="relativetime" data-value="2023-11-17T11:08:22+00:00" > 11/17/23, 11:08 </span> -
Gerrit Code Review pushed patch set 2 for main to change 81763 <span data-processor="relativetime" data-value="2024-10-18T14:08:19+00:00" > 10/18/24, 14:08 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 81763 <span data-processor="relativetime" data-value="2025-04-11T21:10:10+00:00" > 04/11/25, 21:10 </span>
-
Benni Mack changed Related to #95714 <span data-processor="relativetime" data-value="2025-04-11T22:20:17+00:00" > 04/11/25, 22:20 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 81763 <span data-processor="relativetime" data-value="2026-04-22T06:27:21+00:00" > 04/22/26, 06:27 </span>
-
Benni Mack commented and changed status
Under ReviewClosed <span data-processor="relativetime" data-value="2026-11-09T09:25:44+00:00" > 11/09/26, 09:25 </span>Fixed on main and 14.3 by #95714 (f6d7f90c0c7 / 03650f2e890, Gerrit 84625): the media renderers now handle attribute values like Fluid’s TagBuilder. null and false omit the attribute, true renders a boolean attribute, so the htmlspecialchars() deprecation is gone. For a bare playsinline use {playsinline: true}; {playsinline: null} now leaves the attribute out. Closing as resolved.
IMO I would say `null` should not render that attribute at all, true = only name
and otherwise the string casted value put through the sanatizer.
Using “TRUE” and “NULL” for the same thing is compersome. On the otherhand, I don’t
get why it would be proplem to write:
in the template oO