Project

General

Profile

Actions

Bug #102392

open

YouTubeRenderer breaks on boolen html attribute without value

Added by Henrik Elsner 7 months ago. Updated 5 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2023-11-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

Bildschirmfoto 2023-11-17 um 10.09.31.png (145 KB) Bildschirmfoto 2023-11-17 um 10.09.31.png Sentry section of the error Henrik Elsner, 2023-11-17 09:09
Actions #1

Updated by Gerrit Code Review 7 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

Actions #2

Updated by Stefan Bürk 5 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
Actions

Also available in: Atom PDF