Review main Merged

75795[TASK] Avoid getIndpEnv and TYPO3_REQUEST in Link Builder

Benni Mack CR +2 V +2 Normal +114 −61 updated 09/21/22, 13:08

Commit message

This change removes any usage of GeneralUtility::getIndpEnv()
in favor of NormalizedParams (non-global state) and
using ServerRequestInterface from cObject.

With this change, almost all usages of getIndpEnv()
from EXT:frontend are gone.

Also, Prophecies are removed from the affected unit tests.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Christian Kuhn +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benni Mack +2
    • Christian Kuhn +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 1623

  1. Benni Mack uploaded patch set 1 09/20/22, 10:45

  2. Benni Mack updated the commit message in patch set 2 09/20/22, 10:46

  3. core-ci voted on patch set 2 V -1 09/20/22, 11:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31310

  4. core-ci voted on patch set 1 V -1 09/20/22, 11:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31309

  5. Benni Mack uploaded patch set 3 09/20/22, 12:46

  6. Benni Mack uploaded patch set 4 09/20/22, 12:49

  7. core-ci voted on patch set 4 V -1 09/20/22, 12:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31320

  8. core-ci voted on patch set 3 V -1 09/20/22, 12:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31319

  9. Benni Mack uploaded patch set 5 09/20/22, 14:15

  10. core-ci voted on patch set 5 V +1 09/20/22, 14:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31321

  11. Christian Kuhn commented on patch set 5 CR -1 09/21/22, 09:14

    -1 for now to get the two comments answeredd.

    ErrorController.php:139

    why the fallback to createFromRequest? the normalizedParams middleware is very early in the middleware chain. i'd rather getAttribute() and throw an exception if the attribute does not exist?

    AbstractTypolinkBuilder.php:85

    same here as in the other file - i'd say we should expect the attribute is set, and throw an exception if not.
  12. Benni Mack commented on patch set 5 09/21/22, 10:01

    ErrorController.php:139 Reply

    This one can rather go away, I agree.

    AbstractTypolinkBuilder.php:85 Reply

    typolink also "could" made work in an CLI environment, where somebody did not create a full request with normalized params. Instead of having all callers do this on CLI, I suggest to use it the way as I did it. You can see in the tests, that you do not have to populate the normalizedParams. Bottom line: It's more convenient.
  13. Christian Kuhn commented on patch set 5 09/21/22, 10:40

    AbstractTypolinkBuilder.php:85 Reply

    ok. however, we should think about making typo3_request mandatory in typolink / link generation in general, even in cli: typolink *has* a dependency to request and we should make this explicit and force cli to set up a proper request if it generates links (or call a FE application) ... but that's a story for a different patch. we could however add an @todo now that this implicit normalized_params generation should fall at some point.
  14. Christian Kuhn uploaded patch set 6 09/21/22, 11:55

  15. Christian Kuhn commented on patch set 6 09/21/22, 11:55

    ErrorController.php:139 Reply

    Done

    AbstractTypolinkBuilder.php:85 Reply

    Done
  16. core-ci voted on patch set 6 V -1 09/21/22, 12:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31355

  17. Christian Kuhn commented on patch set 6 CR -1 09/21/22, 12:18

    will greenify
  18. Christian Kuhn uploaded patch set 7 09/21/22, 12:42

  19. core-ci voted on patch set 7 V +1 09/21/22, 12:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31364

  20. Christian Kuhn voted on patch set 7 V +1 CR +1 09/21/22, 12:54

  21. Andreas Kienast voted on patch set 7 V +1 CR +1 09/21/22, 13:03

  22. Benni Mack voted on patch set 7 V +2 CR +2 09/21/22, 13:07

  23. Benni Mack merged patch set 8 09/21/22, 13:08