Review 11.5 Merged

75013[BUGFIX] Ensure uncached forms in case of POST requests

Oliver Hader CR +2 V +2 Hard +372 −151 updated 07/12/22, 08:22

Commit message

A new `FormRequestHandler` has been introduced as entry point which
takes care of creating and rendering the actual `FormRuntime`.
Independent of the current application dispatcher (either the
default `FormFrontendController`, any custom Extbase controller
or a TypoScript `FLUIDTEMPLATE` cObject) any processing will
end up here.

To ensure proper caching, it is important to separate the two main
actions `render` and `perform`, which unfortunately cannot be resolved
easily, especially when using custom Extbase controller actions.
The term uncached refers to using cObject `USER_INT` instead of `USER`.

More details about the process flow are described in
`\TYPO3\CMS\Form\Core\FormRequestHandler`, introduced by this change.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • waldhacker +1
    • Björn Jacob +1
    • timobert +1
  • Verified V +2 Done
    • Oliver Hader +2
    • waldhacker +1
    • Björn Jacob +1
    • timobert +1
    • core-ci +1 CI

Issues 2

Files 10

Review log 3140

Show 1015 earlier messages
  1. Oliver Hader uploaded patch set 1 07/01/22, 15:00

  2. Oliver Hader uploaded patch set 2 07/01/22, 15:03

  3. core-ci voted on patch set 1 V -1 07/01/22, 15:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28584

  4. core-ci voted on patch set 2 V -1 07/01/22, 15:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28585

  5. Oliver Hader uploaded patch set 3 07/01/22, 15:40

  6. core-ci voted on patch set 3 V +1 07/01/22, 15:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28590

  7. Oliver Hader marked it ready for review 07/02/22, 17:36

  8. Oliver Hader rebased onto patch set 4 07/02/22, 17:36

  9. core-ci voted on patch set 4 V +1 07/02/22, 17:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28613

  10. Oliver Hader commented on patch set 4 CR -1 07/06/22, 09:55

    FormRequestHandler.php:204

    This should have a fall-back to `GeneralUtility::makeInstance` (compare to previous state in `RenderViewHelper` at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75013/4/typo3/sysext/form/Classes/ViewHelpers/RenderViewHelper.php#b101)
  11. Oliver Hader uploaded patch set 5 07/06/22, 10:38

  12. Oliver Hader commented on patch set 5 07/06/22, 10:41

    FormRequestHandler.php:145

    I'm unsure about this change - it's taken from previous `RenderViewHelper`. When looking to a potential v10.4 back-port, it was still a bit different there → leaving out possible additional header data. @Ralf: I hope, you've got better insight what is required or might happen here.

    FormRequestHandler.php:204 Reply

    Done
  13. core-ci voted on patch set 5 V +1 07/06/22, 10:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28692

  14. Simon Schaufelberger voted on patch set 5 CR +1 07/07/22, 13:17

  15. Stefan Bürk commented on patch set 5 07/08/22, 20:53

    Maybe we should at least "backport" the form tests pre-patch to v11, so the "test update" can be backported to v11 too and ensure this. Late to the party, but really backport to v10 ?
  1. Simon Schaufelberger commented on patch set 5 07/08/22, 21:02

    Reply

    I'm having a cache issue like this: https://forge.typo3.org/issues/91419 Does this patch also fix this issue or is it something else? I haven't understood the usecase in total yet.
  2. Oliver Hader commented on patch set 5 07/09/22, 08:38

    Reply

    > I'm having a cache issue like this: https://forge.typo3.org/issues/91419 > > Does this patch also fix this issue or is it something else? I haven't understood the usecase in total yet. @Simon: There have been lots of aspects in the history of the change that went into the `main` branch, please see https://review.typo3.org/c/Packages/TYPO3.CMS/+/70460 Issue #91419 seems to be partly related, but probably is not resolved completely - without having all snippets that were used, it's difficult to give an answer for that particular issue.
  3. Oliver Hader commented on patch set 5 07/09/22, 08:45

    Reply

    > > I'm having a cache issue like this: https://forge.typo3.org/issues/91419 > > > > Does this patch also fix this issue or is it something else? I haven't understood the usecase in total yet. @Stefan: Having the tests in for v11 would help, yes - however I fear that much more adjustments would be required for the testing framework that is used for TYPO3 v11. Currently, crawlers call the form-action (the URI of the corresponding HTML `<form>` element) directly, which creates a cache entry and leads to the scenario that forms don't take any dynamic data anymore. Besides that, this patch is the foundation to finally get the honeypot feature working (currently it's not very useful). That's why I'd also opt for having this in TYPO3 v10 - actually it solves a "long term regression, LTR" (I just made up this term ;-))
  4. waldhacker uploaded patch set 6 07/09/22, 10:47

  5. core-ci voted on patch set 6 V +1 07/09/22, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28806

  6. Stefan Bürk commented on patch set 6 07/09/22, 11:39

    Reply

    @Oliver No, there are no changes needed in the testing framework. The basic support for requesting POST requests has been backported to TF 6.x too. The only point is, that it is only implementedn in the executeFrontendSubRequest() feature - thus only usable in v11 core tests, not v10 core tests (both uses 6.x TF). However, did a quick check .. not directly working, but errors are related to the core side not the TF. And I would take this as strong argument why tests should be properly backported before - or should we "do this" afterwards ? Pre-patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73722 TF-Commit for TF 6.x: https://github.com/TYPO3/testing-framework/commit/774d2123c907261b79f554c98f25f93ed2b0ee8c --- After your explanation, fine with v10 backport generally (Ack).
  7. Stefan Bürk commented on patch set 6 07/09/22, 13:29

    Reply

    Backported the pre-patch to v11: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75082 However - Ralph added the "files" manually to this patch with patchset 6 in the meanwhile :/
  8. waldhacker commented on patch set 6 07/09/22, 13:32

    Reply

    Yes sorry, I had not realized that you make a seperates patchset. I revert it here.
  9. Stefan Bürk commented on patch set 6 07/09/22, 13:34

    Reply

    No problem, thanks if you would take care of resolve this now. I'm out to the store, will be back later to check this than.
  10. waldhacker uploaded patch set 7 07/09/22, 13:34

  11. core-ci voted on patch set 7 V -1 07/09/22, 13:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28814

  12. waldhacker commented on patch set 8 07/09/22, 13:47

    Published edit on patch set 7.
  13. core-ci voted on patch set 8 V +1 07/09/22, 13:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28816

  14. Stefan Bürk commented on patch set 8 07/09/22, 20:10

    Reply

    Done
  15. Stefan Bürk commented on patch set 8 07/09/22, 20:12

    FormRequestHandler.php:145 Reply

    Not sure/no glue here also looking on a potential backport v10.4. So having a optionon from @Ralph here would be nice ...
  16. Simon Schaufelberger wrote 07/09/22, 21:59

    Removed reviewer Simon Schaufelberger.
  17. waldhacker commented on patch set 8 07/11/22, 16:58

    FormRequestHandler.php:145 Reply

    I think, its ok for v11 to ignore this codeline and use the v10 implementation (in the v10 backport) as is ("return $response->shutdown();"). We can ignore this in the v11 branch, because its dead code anyway since the StopActionException was removed with https://github.com/TYPO3/typo3/commit/8ada892a445ba2801268cab47947e5f90e073c2a#diff-ae5223ac59f428ebacf5b23f1885d433c37c2b3b4da2daa6747817b0c0327998R114
  18. waldhacker uploaded patch set 9 07/11/22, 17:10

  19. core-ci voted on patch set 9 V +1 07/11/22, 17:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28915

  20. waldhacker voted on patch set 9 V +1 CR +1 07/11/22, 17:55

  21. Björn Jacob voted on patch set 9 V +1 CR +1 07/11/22, 18:19

  22. timobert voted on patch set 9 V +1 CR +1 07/12/22, 06:30

  23. Björn Jacob commented on patch set 9 07/12/22, 07:09

    FormRequestHandler.php:145 Reply

    Done
  24. Oliver Hader voted on patch set 9 V +2 CR +2 07/12/22, 08:22

  25. Oliver Hader merged patch set 10 07/12/22, 08:22