#100671Responses returned from initializeAction methods are not processed
Description
While upgrading Powermail to version 12 we noticed that forwarding inside an initializeAction method does not work (anymore).
With TYPO3 11 (and now required in 12) actions require a ResponseInterface to be returned. Now if we want to forward/redirect ahead of an action, for guarding purposes, we thought that returning a Response inside initialize{action}Action would yield that result.
It doesn’t, and so we don’t have a way to respond differently ahead of an action being called. Or at least, as simple as it was before.
We need this functionality because we are validating that arguments are sent against the correct form, but due to ActionController not stopping to process a request when any Response has been returned from an initializeAction method, it continues on with the actual action, causing validation errors and other wrong behaviour.
Is this a bug, or what is the best approach in version 12 to forward before an action is being called?
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 5
-
Christian Kuhn commented <span data-processor="relativetime" data-value="2023-04-20T13:38:03+00:00" > 04/20/23, 13:38 </span>
-
Christian Kuhn changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2023-04-21T05:39:07+00:00" > 04/21/23, 05:39 </span> -
Stefan Froemken commented <span data-processor="relativetime" data-value="2025-06-06T08:16:55+00:00" > 06/06/25, 08:16 </span>
I understand the problem, but I also don’t want to change the behavior of initializeActions. Extbase only delivers possibilities to modify the response in AfterRequestDispatchedEvent, but extbase does not provide a possibility to create your own early return response objects. IMO we should add a further event in between of resolveController in Dispatcher and processRequest. That way you can handle own method calls to your controller, you can change $isDispatched and of cause you can build your own $response object.
Until this is implemented I prefer overriding the “processRequest” method in your specific extbase controller
public function processRequest(RequestInterface $request): ResponseInterface { if ($request->getArgument('whatever') === 'that') { return new MyOwnResponseObject(); // Or forward response } return parent::processRequest($request); }Stefan
-
Torben Hansen commented <span data-processor="relativetime" data-value="2025-06-06T10:04:14+00:00" > 06/06/25, 10:04 </span>
I could not find it in gerrit, but as far as I remember from the last codesprint, @pixeldesu created a WIP patch which enables the possiblity to modify the response before the request is dispatched.
-
Georg Ringer commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2026-10-07T14:19:52+00:00" > 10/07/26, 14:19 </span>can be implemented using #107826
Mmmh. I’m not entirely sure, but I’d argue that initialize*() actions in extbase are not supposed to return a response, but void.
Their idea is to contain action set up, and should most likely not be abused for validation purposes.
I don’t insist on this view (at first thought), but maybe it’s better to have a first action that does your custom validation, which returns a redirect response on failure, and to forward to another action otherwise? What do you think?