Review main Merged

71084[BUGFIX] Fix TypoScriptFrontendController initialization in subrequests

Simon Schaufelberger CR +2 V +2 Normal +29 −28 updated 09/16/21, 17:36

Commit message

With the introduction of #94402 error pages are fetched via a
sub-request. Manual "page not found" ErrorController invocations
within an extbase action then resulted in rendering the originally
requested page instead of the defined 404 page.
This happened because the PrepareTypoScriptFrontendRendering
middleware hold a reference to the outer TSFE instance which
contains the original page id.

Instead of injecting the stateful TSFE (which is generally discouraged),
TSFE in now passed as request attribute. The container will
log an according warning message from now on.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Simon Gilli +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Simon Gilli +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 1114

  1. Simon Schaufelberger uploaded patch set 1 09/14/21, 17:12

  2. Simon Schaufelberger commented on patch set 1 09/14/21, 17:15

    I would like to cover this change with a functional or acceptance test but I need some support in doing that. Additionally I also want to know if this is the right approach to solve this bug or if there is an even better solution.
  3. core-ci voted on patch set 1 V +1 09/14/21, 17:27 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16714

  4. crell commented on patch set 1 09/15/21, 16:06

    As long as TSFE is stateful, it shouldn't be injected, so as gross as globals are this is probably the best solution. However, we should also include an additional test to verify the change. I'm not sure what that test would look like, though, as I thought I got all the relevant tests originally. :-/
  5. Benjamin Franzke uploaded patch set 2 09/16/21, 15:58

  6. Benjamin Franzke commented on patch set 2 09/16/21, 15:58

    Reply

    As discussed before, we should use a request attribute instead of GLOBALS and avoid injecting stateful services, yea. TypoScriptFrontendController isn't a service, but a propotype (it is shared: false).
  7. core-ci voted on patch set 2 V +1 09/16/21, 16:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16811

  8. Simon Schaufelberger commented on patch set 2 09/16/21, 16:33

    Services.yaml:19

    "is breaks" sounds strange. I guess "is" needs to be deleted.
  9. Benjamin Franzke uploaded patch set 3 09/16/21, 16:59

  10. Benjamin Franzke commented on patch set 3 09/16/21, 16:59

    Services.yaml:19 Reply

    Right, fixed…
  11. core-ci voted on patch set 3 V +1 09/16/21, 17:12 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16821

  12. Simon Gilli voted on patch set 3 V +1 CR +1 09/16/21, 17:16

  13. Benjamin Franzke voted on patch set 3 V +2 CR +2 09/16/21, 17:36

  14. Benjamin Franzke merged patch set 4 09/16/21, 17:36