Review main Merged

84625[BUGFIX] Omit null attributes in media rendering

Georg Ringer CR +2 V +2 Normal +98 −4 updated 09/04/26, 07:50

Commit message

The media file renderers merge the values of the option
"additionalAttributes" into the tag attributes without looking at
their type. A null value therefore ends up as name="", and in
VimeoRenderer and YouTubeRenderer it reaches htmlspecialchars(),
which raises a deprecation notice and turns into a TypeError with
PHP 9.

The four renderers now follow the same rules as the TagBuilder of
Fluid: null and false omit the attribute, true renders a boolean
attribute and an empty string is kept as name="".

Keeping empty strings matters, as muted="" and muted are
equivalent in HTML and dropping them would change the meaning of
the markup. As a side effect an attribute can now be left out
conditionally, which resolves the original request.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 2

Files 9

Review log 1622

  1. Georg Ringer uploaded patch set 1 06/11/24, 18:50

  2. Georg Ringer commented on patch set 1 06/11/24, 18:50

    This change is ready for review.
  3. core-ci voted on patch set 1 V -1 06/11/24, 18:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59236

  4. Georg Ringer commented on patch set 2 V -1 06/11/24, 18:57

    Published edit on patch set 1.
  5. core-ci voted on patch set 2 V +1 06/11/24, 19:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59237

  6. Garvin Hicking commented on patch set 2 06/26/24, 20:37

    I think this could cause trouble. Per spec (so I was told by some busy bee) a html5 definition of muted="muted", muted, muted="" would all be considered as "set". But this would then drop muted="" and be no longer set, which can have a breaking impact. Maybe in this case the default fluid templates of f:media would need to adopt putting "poster" into its own check, and only put it as an attribute when it exists? (Another sidenote, https://review.typo3.org/c/Packages/TYPO3.CMS/+/76103 seemy related and the solutions should ideally be aligned)
  7. Benni Mack updated the commit message in patch set 3 V +1 10/18/24, 13:36

  8. core-ci voted on patch set 3 V -1 10/18/24, 22:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68000

  9. Benni Mack commented on patch set 3 04/11/25, 21:59

  10. Benni Mack wrote 04/21/26, 14:58

    Removed cc Benni Mack.
  11. Benni Mack updated the commit message in patch set 4 V -1 04/22/26, 06:50

  12. core-ci voted on patch set 4 V -1 04/22/26, 11:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100813

  13. Georg Ringer uploaded patch set 5 V -1 09/03/26, 18:17

  14. core-ci voted on patch set 5 V +1 09/03/26, 18:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107769

  15. Garvin Hicking commented on patch set 5 CR +1 V +1 09/04/26, 06:25

    Reply

    Done
  16. Oliver Klee voted on patch set 5 CR +1 V +1 09/04/26, 06:37

  17. Garvin Hicking commented on patch set 6 CR +1 V +1 09/04/26, 06:49

    Published edit on patch set 5.
  18. Garvin Hicking voted on patch set 6 CR +1 V +1 09/04/26, 06:50

  19. core-ci voted on patch set 6 V +1 09/04/26, 07:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107812

  20. Oliver Klee voted on patch set 6 CR +1 V +1 09/04/26, 07:49

  21. Garvin Hicking voted on patch set 6 CR +2 V +2 09/04/26, 07:50

  22. Garvin Hicking merged patch set 7 09/04/26, 07:50