#91560ActionController::forward() not work with different target controller - Needs better error description
Description
I use a forward in one action to an action in another controller. With version <= 9.5 it worked without any problems. But with 10.4 the controller class cannot be found.
TYPO3\CMS\Extbase\Mvc::controllerAliasToClassNameMapping has only the mapping of the controller for the first action.
The error was that the action in the flexform was not allowed. There would be a better error message here if the controller could not be found or a fallback with a warning.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] ActionController::forward() not work with different target controller - Needs better error description Resolves: #91560 Releases: main
History 3
-
Lars Peter Søndergaard commented <span data-processor="relativetime" data-value="2020-06-16T15:44:17+00:00" > 06/16/20, 15:44 </span>
-
Nico de Haen commented <span data-processor="relativetime" data-value="2020-12-04T16:13:58+00:00" > 12/04/20, 16:13 </span>
Lars Peter Søndergaard wrote in #note-1:
>
> My suggestion would be to either allow the full controller class name to ActionController::forward, instead of just the Alias, or throw an error if the class could not be found in the forward method.
> The first method seems more reasonable, since it matches whatExtensionUtility::configurePluginexpects.There is a “work around” so far. Before forwarding you have to set:
$this->getControllerContext()->getRequest()->setControllerAliasToClassNameMapping( ['ControllerAlias' => FullControllerClassName::class] ); $this->forward('actionName', 'ControllerAlias', 'ExtensionName'); -
Simon Schaufelberger commented <span data-processor="relativetime" data-value="2026-02-22T17:15:58+00:00" > 02/22/26, 17:15 </span>
I just stumbled over this bug in TYPO3 13 as well.
Another side bug is that jumping to another page and calling a controller there does NOT redirect you back to where you came from if the action fails.
This is because the internal
ForwardResponseinActionControlleris not aware of the page where you come from.
Can confirm
In a regular plugin configured with
ExtensionUtility::configurePlugin, if the controller that is being forwarded to is not listed in the$controllerActionsargument, then the forward will fail with an obscure “class not found” error message, without any indications of where the error originates from, or what class it’s talking about (because it’s working with an empty string).My suggestion would be to either allow the full controller class name to ActionController::forward, instead of just the Alias, or throw an error if the class could not be found in the forward method.
The first method seems more reasonable, since it matches what
ExtensionUtility::configurePluginexpects.