96940[FEATURE] Dispatch Extbase actions through a PSR-15 middleware stack
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 5
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/40/96940/5 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/40/96940/5 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V +1 Needs a vote
- Oliver Klee +1
- core-ci +1 CI
Relation chain 2
- main 96941[!!!][FEATURE] Run Extbase action invocation through a middleware stack
-
96940 [FEATURE] Dispatch Extbase actions through a PSR-15 middleware stack This change
Merge conflicts 25
- main 94552[WIP][FEATURE] Passwordless passkey login for the backend
- main 91666[TASK] Provide OpenAPI spec w/ Swagger UI for Actions API
- main 91563[FEATURE] Introduce Action API
- main 92197[WIP][FEATURE] Provide Record Actions
- main 91486[FEATURE] Implement API Hub
- main 66322[FEATURE] Introduce new uri builder classes
- main 94753[FEATURE] New TCA type "coordinate"
- main 96543[WIP][POC][TASK] Write and read records by the same rules and rights
- main 96660[TASK] Derive argument schemas from signatures
- main 96661[TASK] Add capability invoker and registry
- main 96811[WIP][TASK] Compare Extbase persistence with the core in paired tests
- main 96682[FEATURE] Add MCP system extension and endpoint
- main 94709[BUGFIX] Fix sending spooled emails using HttpTransport
- main 96533[WIP][!!!][TASK] Build Extbase persistence on doctrine/orm
- main 96201[FEATURE] Introduce upload constraints for file uploads
- main 88507[WIP][FEATURE] AI suggest demo using tools API
- main 95337[WIP][TASK] Evaluate phpunit parallel test execution
- main 94945[WIP][TASK] Test testing-framework context leak fix
- main 94029[FEATURE] Add secrets store and key management
- main 92349[TASK] Replace deprecated usage for custom phpstan rule and add tests
- main 91936[POC][FEATURE] Extbase Route Annotations
- main 92068[WIP][TASK] Avoid Symfony v8 for transitive Symfony dependencies
- main 85574[WIP][FEATURE] Language-aware slugs and slug normalizer API
- main 76662[FEATURE] Introduce global routes
- main 88232[WIP][TASK] fixture-packages composer plugin
Issues 2
Files 23
- typo3/sysext/core/Documentation/Changelog/15.0/Feature-111178-PSR15MiddlewareStackForExtbaseActionDispatching.rst2new+138 −0
- typo3/sysext/extbase/Classes/Http/ControllerRequestHandler.php3new+64 −0
- typo3/sysext/extbase/Classes/Http/ForwardResponse.php1+18 −0
- typo3/sysext/extbase/Classes/Mvc/Dispatcher.php+16 −35
- typo3/sysext/extbase/Configuration/Services.yaml1+6 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Controller/OtherController.phpnew+42 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Controller/RecordingController.phpnew+50 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/OrderAMiddleware.phpnew+33 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/OrderBMiddleware.phpnew+33 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/OrderCMiddleware.phpnew+33 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/PlainRequestMiddleware.phpnew+39 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/RecordingMiddleware.phpnew+46 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/ReplaceControllerMiddleware.phpnew+41 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/ReplaceForwardResponseMiddleware.phpnew+36 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Middleware/ShortCircuitMiddleware.phpnew+40 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Classes/Recorder.phpnew+29 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Configuration/RequestMiddlewares.phpnew+67 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/Configuration/Services.yamlnew+8 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/middleware_stack_test/composer.jsonnew+23 −0
- typo3/sysext/extbase/Tests/Functional/Mvc/DispatcherMiddlewareStackTest.phpnew+330 −0
Review log 1823
-
Alexander Schnitzler uploaded patch set 1 10/20/26, 15:59
-
core-ci voted on patch set 1 V +1 10/20/26, 16:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111879
-
Alexander Schnitzler commented on patch set 1 10/20/26, 17:21
This change is ready for review. -
Simon Schaufelberger commented on patch set 1 10/22/26, 19:22
ControllerRequestHandler.php:57What about using ControllerInterface::class? -
Oliver Klee voted on patch set 1 V +1 10/22/26, 19:39
-
Matthias Vogel uploaded patch set 2
V +110/23/26, 09:28Preserve middleware request changes in forwards -
Matthias Vogel commented on patch set 2 CR +1 V +1 10/23/26, 09:32
ControllerRequestHandler.php:57ReplyDone -
Simon Schaufelberger voted on patch set 2 CR +1 V +1 10/23/26, 10:19
-
Alexander Schnitzler commented on patch set 2 10/23/26, 10:30
Thanks for taking care. -
core-ci voted on patch set 2 V -1 10/23/26, 10:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112256
-
Matthias Vogel rebased onto patch set 3
CR +1V +110/23/26, 10:45 -
Matthias Vogel voted on patch set 3 CR +1 V +1 10/23/26, 10:46
-
core-ci voted on patch set 3 V +1 10/23/26, 11:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112272
-
Benni Mack commented on patch set 3 10/28/26, 16:01
does it make sense to deprecate the Event at a later point? -
Alexander Schnitzler commented on patch set 3 10/29/26, 10:48
Reply
Yes, I think that makes sense, in a separate change once the stack is merged. A middleware in the "extbase" stack can do everything a listener for AfterRequestDispatchedEvent can: it runs once per forward pass, and the pass whose response is not a ForwardResponse is the final one. It even sees the request that was actually processed, while the event only gets the request used to enter the final pass (the RST says so as well). I'd keep 96940 a purely non-breaking feature and follow up with the deprecation of the event in its own change, with its own ticket, RST and scanner entry. Does that work for you? -
Benni Mack commented on patch set 3 10/29/26, 11:21
Reply
yes -
Oli Bartsch commented on patch set 3 10/29/26, 11:39
Feature-111178-PSR15MiddlewareStackForExtbaseActionDispatching.rst:16UnresolvedCan we add a paragraph to the frontend part saying that middlewares run after the allowed controller/action check and the `nonCacheableActions` decision? A middleware that changes controller or action is responsible for both, as with a `ForwardResponse`. Otherwise a middleware can switch a cached USER plugin to a non-cacheable or disallowed action and the output ends up in the page cache.Feature-111178-PSR15MiddlewareStackForExtbaseActionDispatching.rst:82UnresolvedIMO the `ActionTiming` example should wrap `$handler->handle()` in `try/finally` and record the duration in `finally`. Timing across exceptions is the stated motivation, but as written nothing is recorded when the action fails.ControllerRequestHandler.php:43UnresolvedThe branch that wraps a plain PSR-7 request in `new Request()` is not covered, as the "new request instance" data set in `DispatcherMiddlewareStackTest` passes an Extbase `Request`. Could you add a data set where the middleware passes a plain `ServerRequest` with the `extbase` attribute, asserting dispatch and forward source?ForwardResponse.php:43UnresolvedI suggest to mark `withSourceRequest()` and `getSourceRequest()` as `@internal`. As public API they give two different forward bases depending on who built the response: the controller's request carries earlier middleware changes into the next pass, so a non-idempotent middleware applies them twice, while a middleware-built response starts from the stack input. So we could keep the attach in `ControllerRequestHandler`, drop the RST section regardign `withSourceRequest()` and document instead that middlewares see their own earlier request changes on a forward pass and must be idempotent.Services.yaml:35UnresolvedPlease consider using `#[AutowireInline(class: MiddlewareDispatcher::class, arguments: [...])]` on the `Dispatcher` constructor, like `frontend/Classes/Http/Application.php:40`. That avoids a named `extbase.middleware-dispatcher` service becoming a de facto contract that others might decorate. Only `extbase.middlewares` needs to stay named, since lowlevel uses it. -
Alexander Schnitzler rebased onto patch set 4
CR +1V +111/04/26, 08:55 -
core-ci voted on patch set 4 V +1 11/04/26, 09:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113262
-
Alexander Schnitzler uploaded patch set 5
V +111/04/26, 10:01 -
core-ci voted on patch set 5 V +1 11/04/26, 10:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113268
-
Oliver Klee voted on patch set 5 V +1 11/04/26, 11:51
-
Alexander Schnitzler commented on patch set 5 11/11/26, 08:46
Unresolved
@bo@cedev.de Are you happy with the requested changes?