Review 11.5 Merged

77159[BUGFIX] Fix absolute backend URL generation in frontend context

Benjamin Franzke CR +2 V +2 Normal +47 −6 updated 12/15/22, 10:03

Commit message

$normalizedParams->getRequestDir() returns '/' for frontend
requests and `/typo3/` for backend requests. This results in
problems when the backend UriBuilder relies on getRequestDir()
to provide the `/typo3/` suffix for backend URL generation.

UriBuilder is now changed to base absolute URLs on
getSiteUrl(), which is defined to return equal values
for backend and frontend requests, the typo3 suffix
is added manually.

Note that v12 introduced similar behavior with #99234,
where UriBuilder was adapted to use BackendEntryPointResolver,
which rebases the backend URL calculation on the site path as well.

Also note that the ABSOLUTE_URL mode in backend UriBuilder isn't
actually used by the TYPO3 frontend, but some extensions started
to execute system reports in frontend context, which
exposed this bug with the introduction of #99347.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Oliver Hader +1
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Oliver Hader +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 3

Files 6

Review log 1723

  1. Benjamin Franzke uploaded patch set 1 12/14/22, 21:29

  2. Oliver Hader updated the commit message in patch set 2 12/14/22, 21:31

  3. Oliver Hader commented on patch set 2 12/14/22, 21:32

    Added `12.1` to `Releases` line
  4. Oliver Hader updated the commit message in patch set 3 12/14/22, 21:33

  5. Oliver Hader commented on patch set 3 12/14/22, 21:34

    Removed `12.1` again, https://review.typo3.org/c/Packages/TYPO3.CMS/+/76865 was integrated in `12.1.0`.
  6. core-ci voted on patch set 1 V -1 12/14/22, 21:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35122

  7. core-ci voted on patch set 3 V -1 12/14/22, 22:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35125

  8. Benjamin Franzke uploaded patch set 4 V -1 12/15/22, 06:26

  9. core-ci voted on patch set 4 V -1 12/15/22, 06:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35146

  10. Benjamin Franzke uploaded patch set 5 V -1 12/15/22, 06:39

  11. core-ci voted on patch set 5 V +1 12/15/22, 06:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35147

  12. Oliver Hader commented on patch set 5 12/15/22, 08:14

    UriBuilderTest.php:375

    This one looks strange, actually `/typo3/index.php` seemed to be correct. Wasn't it? Maybe it's related to `getRequestWithRouteAttribute` using `new Uri('')`?
  13. Benjamin Franzke commented on patch set 5 12/15/22, 08:24

    UriBuilderTest.php:375 Reply

    I agree, ideally we'd test both cases. I actually just copied that 1:1 from this change in v12 https://review.typo3.org/c/Packages/TYPO3.CMS/+/75620/16/typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php#380
  14. Benjamin Franzke uploaded patch set 6 V +1 12/15/22, 08:42

  15. Benjamin Franzke commented on patch set 6 12/15/22, 08:42

    UriBuilderTest.php:375 Reply

    Adapted to test both cases.
  16. Oliver Hader voted on patch set 6 V +1 CR +1 12/15/22, 08:47

  17. core-ci voted on patch set 6 V -1 12/15/22, 08:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35153

  18. Benjamin Franzke uploaded patch set 7 CR +1 V +1 12/15/22, 08:51

  19. Oliver Hader voted on patch set 7 V +1 CR +1 12/15/22, 08:56

  20. core-ci voted on patch set 7 V +1 12/15/22, 09:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35155

  21. Benni Mack voted on patch set 7 V +1 CR +1 12/15/22, 10:02

  22. Benjamin Franzke voted on patch set 7 V +2 CR +2 12/15/22, 10:03

  23. Benjamin Franzke merged patch set 8 12/15/22, 10:03