Bug #102392
openYouTubeRenderer breaks on boolen html attribute without value
0%
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
Files
Updated by Gerrit Code Review 10 months ago
- Status changed from New to Under Review
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/+/81763
Updated by Stefan Bürk 8 months ago · Edited
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:
<f:media
class="video-embed-item" file="{file}" alt="{file.alternative}" title="{file.title}"
additionalAttributes="{playsinline:true, poster: posterimage}"
/>
in the template oO