Review main Work in progress Quiet

96323[BUGFIX] Skip invalid attribute names in implodeAttributes()

Benni Mack CR 0 V -1 Normal +103 −6 updated 10/23/26, 12:44

Commit message

With $convertValues enabled, attribute names that are not valid
according to the HTML specification (controls, whitespace, quotes,
">", "/", "=", noncharacters, empty names) are now skipped, and
names are de-duplicated case-insensitively.

This restores the protection for "data" and "additionalConfig"
keys of the video and audio renderers, which were previously
escaped by hand and are now passed on unescaped. htmlspecialchars()
was never sufficient for attribute names, as it keeps whitespace
and "=" intact.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/23/96323/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/23/96323/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V -1 Blocked
    • core-ci -1 CI

Merge conflicts 3

Issues 2

Files 4

Review log 68

  1. Benni Mack uploaded patch set 1 10/02/26, 16:35

  2. core-ci voted on patch set 1 V -1 10/02/26, 16:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109975

  3. Benni Mack commented on patch set 2 V -1 10/05/26, 07:24

    Published edit on patch set 1.
  4. Benni Mack marked it work in progress 10/05/26, 07:27

  5. core-ci voted on patch set 2 V -1 10/05/26, 07:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110076

  6. Ayke Halder commented on patch set 2 10/05/26, 10:30

    GeneralUtility.php:1027 Unresolved

    Do we need to also skip invalid attribute names here?

    GeneralUtility.php:1071

    ```suggestion '/(?:' . '[\x{0000}-\x{0020}\x{007F}-\x{009F}"\'>\/=\x{FDD0}-\x{FDEF}]' . '|\x{FFFE}|\x{FFFF}|\x{1FFFE}|\x{1FFFF}|\x{2FFFE}|\x{2FFFF}|\x{3FFFE}|\x{3FFFF}' . '|\x{4FFFE}|\x{4FFFF}|\x{5FFFE}|\x{5FFFF}|\x{6FFFE}|\x{6FFFF}|\x{7FFFE}|\x{7FFFF}' . '|\x{8FFFE}|\x{8FFFF}|\x{9FFFE}|\x{9FFFF}|\x{AFFFE}|\x{AFFFF}|\x{BFFFE}|\x{BFFFF}' . '|\x{CFFFE}|\x{CFFFF}|\x{DFFFE}|\x{DFFFF}|\x{EFFFE}|\x{EFFFF}|\x{FFFFE}|\x{FFFFF}' . '|\x{10FFFE}|\x{10FFFF}' . ')/u', ``` This should be slightly faster. AI: "For sparse, repeating patterns across 17 planes (like U+nFFFE / U+nFFFF), explicit alternation allows PCRE to build an optimized lookup trie without needing complex range math." „PCRE's DFA/JIT compiler analyzes the list during compilation and constructs an internal prefix trie (a state machine tree).„ ``` ┌─> 0x0FFFE ├─> 0x0FFFF ├─> 0x1FFFE ┌─> ... ─┼─> ... Root ────┼─> 0x4 ─┼─> 0x4FFFE │ └─> 0x4FFFF └─> ... ─> 0x10FFFF ```
  7. Garvin Hicking commented on patch set 2 10/16/26, 09:42

    @benni@typo3.org Could you maybe make a benchmark on the full test suite run with and without this change? I'd be curious to know if running the regexp engine on a method that might be called very often (for small strings most likely) has a meaningful impact. And maybe we should use mb_strtolower?
  8. Ayke Halder commented on patch set 2 10/19/26, 16:07

    Reply Unresolved

    UTF-8 validation which is triggered for newly created/concatenated strings by `preg_match('//u', …)` takes a big bite of computation time: https://3v4l.org/u3sWB#v8.5.11

    GeneralUtility.php:1071 Reply

    Benchmark shows no impact - or even a decline in performance. https://3v4l.org/VbfOK#v8.5.11 ``` Execution time A: 0.065146 sec. Execution time B: 0.066489 sec. Execution time A: 0.065246 sec. Execution time B: 0.066766 sec. Execution time A: 0.065190 sec. Execution time B: 0.066526 sec. ```