Review main Merged

91396[BUGFIX] Ensure uri.action and link.action work the same

Markus Klein CR +2 V +2 Hard +98 −246 updated 11/18/25, 10:13

Commit message

Remove all code duplication from the viewhelpers
by centralizing the code within uri.action.

Furthermore, ensure that all arguments are
processed identical with/-out extbase context.

All arguments have been checked one-by-one
to ensure default values and data types
are processed correctly.

Review

  • Code review CR +2 Done
    • Simon Praetorius +2
    • Lina Wolf +1
  • Verified V +2 Done
    • Simon Praetorius +2
    • Lina Wolf +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 2935

Show 610 earlier messages
  1. Markus Klein uploaded patch set 1 10/31/25, 15:40

  2. core-ci voted on patch set 1 V -1 10/31/25, 15:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88274

  3. Markus Klein uploaded patch set 2 V -1 10/31/25, 16:03

  4. Markus Klein uploaded patch set 3 10/31/25, 16:04

  5. Markus Klein uploaded patch set 4 10/31/25, 16:06

  6. core-ci voted on patch set 2 V -1 10/31/25, 16:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88277

  7. core-ci voted on patch set 3 V +1 10/31/25, 16:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88278

  8. core-ci voted on patch set 4 V +1 10/31/25, 16:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88279

  9. Georg Ringer commented on patch set 4 10/31/25, 17:56

    ActionViewHelper.php:93

    can't we move that to a service class? one VH calling another one looks kind of bad. not blocking anything
  10. Markus Klein commented on patch set 4 10/31/25, 22:16

    ActionViewHelper.php:93 Reply

    Thought about this too for a long time. But what's the gain? Yet another "service" class as a bolster for 2 static functions? Functions purely related to the viewhelpers, not generic at all and actually a wrapper around typolink/uribuilder. That's why I went for the compromise to have public static functions and having those extremely similar VHs use each other. But I do not insist on that "architecture", by no means.
  1. Simon Praetorius commented on patch set 4 10/31/25, 22:58

    ActionViewHelper.php:93 Reply

    This feels weird for me as well. To start, these methods are probably only static because it was a requirement for renderStatic(). They should probably just be normal non-static methods. So the next question is: If there's really that much glue code necessary to generate a link, how can we make sure that both instances use the same code? Several variants come to mind: * abstract class * trait * call other ViewHelper with Fluid's proper API: ViewHelperInvoker * service class I'm still not sure what's the best variant: For abstract classes, there's precedent, but it's not really meant for that. For traits there's no real precedent and there are mixed opinions about those. ViewHelperInvoker would again bind the leaf classes together. And a service class seems kind of overkill. But something else to consider: Fluid v5 (to be merged before 14.0) will add stronger type checks to ViewHelper arguments, so a lot of the casting and null-checks will probably no longer be necessary then... https://github.com/TYPO3/Fluid/commit/e36d4c2651eab8af6a6dfb265626555c4ed276d7
  2. Markus Klein commented on patch set 4 11/02/25, 20:12

    ActionViewHelper.php:93 Reply

    Thanks for summarizing this Simon. That's exactly why I kept the static functions. These are "stupid" processing functions, with no state; so static is just fine in that regard. Since I'd like to have this fixed in v13 too, I really do not want to wait for Fluid v5 in this regard. Please, let's make the world better for now and not only the distant future. (v13 is still not the most used core version, so this will be the upgrade target for lots of projects) I'm happy to see this way more simplified in v14, once we got Fluid v5 under the hood. I really need this code simplification in order to be able to have 1 straight breaking change, when making pageType working how it should. Thanks.
  3. Simon Praetorius commented on patch set 4 11/03/25, 18:15

    ActionViewHelper.php:80

    Can we add a comment here? Something like: > Since f:uri.action and f:link.action use exactly the same ViewHelper arguments, the glue code between the ViewHelper API and TYPO3's URI generation is shared across both ViewHelpers.

    ActionViewHelper.php:93

    Can we get rid of the `$renderChildrenClosure` as a function argument? I don't particularly like sharing that closure with internal Fluid state across ViewHelpers. In fact, I'm a bit confused what the different use cases are here. Maybe we can clarify that a bit by providing the result of `renderChildren()` to the static function instead of the closure and giving it a better name. If I understand it correctly, this is a Typolink string that will also be used as fallback (... and as tag content for link.action)? oO

    ActionViewHelper.php:93 Reply

    Fine by me! Let's stick to your pragmatic solution.

    ActionViewHelper.php:225

    Very strange. But we can leave it for now...
  4. Markus Klein commented on patch set 4 11/04/25, 09:10

    ActionViewHelper.php:80 Reply

    Will add this.

    ActionViewHelper.php:93 Reply

    Sure, we can do do that. The child-content is indeed only used as fallback-text (which is not really sensible in the uri.action case) and within exceptions.

    ActionViewHelper.php:225 Reply

    looks like backwards compat code. didn't touch, will not touch with this change. ;-)
  5. Markus Klein uploaded patch set 5 V +1 11/04/25, 10:15

  6. Markus Klein commented on patch set 4 11/04/25, 10:15

    ActionViewHelper.php:80 Reply

    Done

    ActionViewHelper.php:93 Reply

    Done
  7. Markus Klein commented on patch set 5 11/04/25, 10:16

    ActionViewHelper.php:93 Reply

    Done
  8. core-ci voted on patch set 5 V +1 11/04/25, 10:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88449

  9. Simon Praetorius voted on patch set 5 CR +1 V +1 11/04/25, 11:25

  10. Lina Wolf commented on patch set 5 CR +1 V +1 11/04/25, 12:52

    Testet with the t3docs/example extensions non Extbase Haiku plugin and the t3doc/blog-example extensions Extbase plugin. I am all for a pragmatic solution here.
  11. Simon Praetorius voted on patch set 5 CR +2 V +2 11/04/25, 17:25

  12. Ayke Halder commented on patch set 5 CR -1 11/04/25, 17:50

    Please check limits of `$arguments['pageUid']` and `$arguments['pageType']`

    ActionViewHelper.php:194

    This allows for `$pageUid` to be `0` or negative. The old code only called `UriBuilder::getTargetPageUid($pageUid)` in case `$pageUid > 0`. ```suggestion $pageUid = max(0, (int)($arguments["pageUid"] ?? 0)) ?: null); ```

    ActionViewHelper.php:195

    This allows for `$pageType` to be `0` or negative. The old code only called `UriBuilder::setTargetPageType($pageType)` in case `$pageType > 0`. As `UriBuilder::pageType` defaults to `0`, this can also be called with `0`. ```suggestion $pageType = max(0, (int)$arguments['pageType']); ```

    ActionViewHelper.php:235

    Is there a reason `TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::setTargetPageUid(int $targetPageUid)` does not accept `null`? We might change that there and remove the `if`-clause here. `UriBuilder::getTargetPageUid(): ?int` already allows return value of `null` as `$this->targetPageUid` is initialised with `null` anyway.

    ActionViewHelper.php:240

    `setTargetPageType` is already called above - without any check.
  13. Ayke Halder commented on patch set 5 11/04/25, 18:03

    ActionViewHelper.php:195 Reply

    And suppress `PHP Notice: Undefined index: pageType`: ```suggestion $pageType = max(0, (int)($arguments['pageType'] ?? 0)); ```
  14. Simon Praetorius commented on patch set 5 11/04/25, 18:17

    (waiting on backport conflicts to be resolved)

    ActionViewHelper.php:195 Reply

    I think this line will be touched in a follow-up anyways, but I'll let Markus respond here.
  15. Markus Klein commented on patch set 5 V -1 11/04/25, 18:18

    ActionViewHelper.php:195 Reply

    pageType has a default value defined in its registration, hence this can't happen.

    ActionViewHelper.php:235 Reply

    See https://forge.typo3.org/issues/107347 for this. This is the upcoming breaking change for v14 I'm about to prepare. This patch only does the pre-work to cleanup things.

    ActionViewHelper.php:240 Reply

    This is indeed a mistake, the call above is wrong!
  16. Simon Praetorius voted on patch set 5 CR +1 V +1 11/04/25, 18:19

  17. Markus Klein commented on patch set 5 11/04/25, 18:22

    ActionViewHelper.php:194 Reply

    It did in this class, but not in the other! The sole reason to get this right, now, finally. Moreover, the direct call to the setter is wrong and removed in the next patch-set

    ActionViewHelper.php:240 Reply

    Done
  18. Markus Klein uploaded patch set 6 CR +1 V +1 11/04/25, 18:22

  19. core-ci voted on patch set 6 V +1 11/04/25, 18:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88475

  20. Markus Klein commented on patch set 6 11/04/25, 18:46

    Reply

    Done

    ActionViewHelper.php:235 Reply

    Done
  21. Lina Wolf voted on patch set 6 CR +1 V +1 11/04/25, 19:37

  22. Markus Klein commented on patch set 6 11/04/25, 20:27

    ActionViewHelper.php:195 Reply

    Done
  23. Simon Praetorius voted on patch set 6 CR +2 V +2 11/05/25, 08:40

  24. Simon Praetorius merged patch set 7 11/05/25, 08:40

  25. Markus Klein commented on patch set 7 11/18/25, 10:13