Review main Merged

93529[BUGFIX] Correctly merge components and viewhelper XSD

Simon Praetorius CR +2 V +2 Normal +171 −42 updated 04/08/26, 17:44

Commit message

If a global Fluid namespace consists of both ViewHelpers and components,
the XSD file doesn't contain all components because the property
`name` is used as as array index, which is always `null` for
components. This patch addresses this using `tagName`, which is set
for components as well as ViewHelpers.

Unit tests are added to cover the merging of ViewHelper namespaces.

Review

  • Code review CR +2 Done
    • Simon Praetorius +2
    • Alexander Grein +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Simon Praetorius +2
    • Alexander Grein +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1519

  1. Simon Praetorius uploaded patch set 1 04/02/26, 14:24

  2. core-ci voted on patch set 1 V +1 04/02/26, 14:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99503

  3. Josua Vogel voted on patch set 1 CR +1 V +1 04/03/26, 06:37

  4. Simon Praetorius commented on patch set 1 V -1 04/07/26, 07:34

    According to @alexander.grein@gmail.com, this doesn't address all the issues. Probably needs unit tests for the merging now...
  5. Simon Praetorius uploaded patch set 2 CR +1 V +1 04/07/26, 15:06

  6. Simon Praetorius commented on patch set 2 04/07/26, 15:09

    SchemaCommand.php:160

    before: `$viewHelper->name` after: `$viewHelper->tagName` Otherwise just renamed variables.
  7. Simon Praetorius commented on patch set 2 04/07/26, 15:09

    SchemaCommand.php:160 Reply

    Done
  8. core-ci voted on patch set 2 V -1 04/07/26, 15:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99707

  9. Simon Praetorius uploaded patch set 3 V -1 04/07/26, 16:10

  10. core-ci voted on patch set 3 V -1 04/07/26, 16:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99708

  11. core-ci voted on patch set 3 V +1 04/07/26, 17:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99708

  12. Alexander Grein commented on patch set 3 CR +1 V +1 04/08/26, 10:53

    It works, but it needs to use the component NS inside component templates to get code assistant for both (viewhelpers and components). This is okay, but may be worth to documentate. Example: <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"; xmlns:mail="http://typo3.org/ns/VENDOR/Extension/Components/ComponentCollection"; data-namespace-typo3-fluid="true">
  13. Simon Praetorius commented on patch set 3 04/08/26, 10:59

    Reply

    Thanks for testing! I think there is not (yet) a chapter about namespace in TYPO3 Explained, but it's documented in Fluid Standalone: https://docs.typo3.org/other/typo3fluid/fluid/main/en-us/ViewHelpers/SchemaFiles.html > Some IDEs support the mapping of such XSD schemas to XML namespace URLs (xmlns="...") which you can include in Fluid templates.
  14. Ayke Halder commented on patch set 3 04/08/26, 15:28

    The exact logic here is hidden for me. Please check by yourself if the mentioned points need further adjustements or are just fine as-is.

    SchemaCommand.php:126

    Might get totally overridden below - see comment below. Is it actually necessary to start filling ` $viewHelperNamespaces` here?

    SchemaCommand.php:152

    Why is the xml namespace always taken from the view-helper that is the first entry of the array? Maybe add a comment into the code, that gives a hint.

    SchemaCommand.php:157

    This removes any existing entry which might have been already set at the top of this function. Is this by design, feature or bug?
  15. Simon Praetorius commented on patch set 3 04/08/26, 16:00

    Reply

    Thanks for looking into it more thoroughly. I agree that the code could be improved. However, I'd like to stick to the bugfix in this patch. I only moved the code around to be able to add tests, there have been no meaningful changes apart from the actual bugfix. I just re-checked this via diff: The only changes are variable names and the actual bugfix.

    SchemaCommand.php:126 Reply

    In most cases, the result of the first foreach will be the final result. Only if global namespaces with more than one entry get involved, the initial result gets thrown away.

    SchemaCommand.php:152 Reply

    I'd have to look into it. That part of the code didn't change.

    SchemaCommand.php:157 Reply

    by design, see other comment.
  16. Christian Kuhn voted on patch set 3 CR +1 V +1 04/08/26, 16:27

  17. Simon Praetorius commented on patch set 3 CR +2 V +2 04/08/26, 16:54

    I will leave the comments open and try to address them in a follow-up if I find the time.
  18. Simon Praetorius merged patch set 4 04/08/26, 16:54

  19. Simon Praetorius commented on patch set 4 04/08/26, 17:44

    Reply

    I made an attempt to simplify it, but I'm not sure if I was successful. This is just a bit complicated overall because this whole namespace merging construct was established a long time ago and has some problems in itself. https://review.typo3.org/c/Packages/TYPO3.CMS/+/93571

    SchemaCommand.php:126 Reply

    Done

    SchemaCommand.php:152 Reply

    Done

    SchemaCommand.php:157 Reply

    Done