Review main Merged

81863[BUGFIX] Avoid calling method on unavailable `frontend.typoscript`

Markus Gerdes CR +2 V +2 Easy +2 −1 updated 11/25/23, 16:21

Commit message

The request attribute 'frontend.typoscript' might not be initialized
at the point of calling `$request->getAttribute` and will return null.

Even if this indicates that something is trying to access extbase to
early in the stack without taking care to bootstrap it properly, the
core should avoid a fatal error at that point.

Therefore, a access guard is added in the `getTypoScriptSetup` method
of the `FrontendConfigurationManager` to mitigate the fatal php error.
The added guard does not fix the invalid state at that point as this
is impossible, so extensions messing around in that early state may
now not fatal but left with an invalid and incomplete state anyway.

Note: This will replaced with a dedicated meaningfull exception in v13
      only in followup.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oli Bartsch +1
    • Oliver Klee +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oli Bartsch +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1316

  1. Markus Gerdes uploaded patch set 1 11/22/23, 16:20

  2. core-ci voted on patch set 1 V +1 11/22/23, 16:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49396

  3. Stefan Bürk voted on patch set 1 CR -1 11/22/23, 20:15

  4. Simon Schaufelberger commented on patch set 1 CR -1 11/23/23, 07:47

    this seams like a bug in the extension
  5. Markus Gerdes commented on patch set 1 11/23/23, 07:55

    Reply

    Hi @simonschaufi+typo3@gmail.com, I agree and have opened a pull request for a small fix for the extension. But I would excpect the TYPO3 core to handle the known possiblity that the getAttribute could return null . At least in TYPO3 v12 where this is written in the comments. Maybe an Exception should be thrown as in the 'getSetupArray` of FrontendTypoScript class ?
  6. Stefan Bürk uploaded patch set 2 CR -1 V +1 11/24/23, 15:51

  7. Stefan Bürk updated the commit message in patch set 3 11/24/23, 15:52

  8. Stefan Bürk commented on patch set 3 CR +1 V +1 11/24/23, 15:53

    Reply

    Done
  9. core-ci voted on patch set 2 V +1 11/24/23, 15:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49895

  10. core-ci voted on patch set 3 V +1 11/24/23, 15:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49896

  11. Oli Bartsch voted on patch set 3 CR +1 V +1 11/24/23, 18:37

  12. Oliver Klee voted on patch set 3 CR +1 11/24/23, 18:43

  13. Christian Kuhn commented on patch set 3 CR -1 11/25/23, 15:01

    will update: i think we should throw in v13 right away and just have a slightly different variant for v12 then.
  14. Christian Kuhn commented on patch set 3 CR +1 V +1 11/25/23, 15:18

    ah, another patch is pending already. ok. so we pick this one as is.
  15. Stefan Bürk voted on patch set 3 CR +2 V +2 11/25/23, 15:32

  16. Stefan Bürk merged patch set 4 11/25/23, 16:21