Project

General

Profile

Actions

Bug #100671

open

Responses returned from initializeAction methods are not processed

Added by Andreas Nedbal about 1 year ago. Updated about 1 year ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2023-04-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

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?

Actions #1

Updated by Christian Kuhn about 1 year ago

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?

Actions #2

Updated by Christian Kuhn about 1 year ago

  • Status changed from New to Needs Feedback
Actions

Also available in: Atom PDF