Project

General

Profile

Actions

Bug #91560

open

ActionController::forward() not work with different target controller - Needs better error description

Added by Markus Pircher over 4 years ago. Updated almost 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2020-06-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

Actions #1

Updated by Lars Peter Søndergaard over 4 years ago

Can confirm

In a regular plugin configured with ExtensionUtility::configurePlugin, if the controller that is being forwarded to is not listed in the $controllerActions argument, 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::configurePlugin expects.

Actions #2

Updated by Nico de Haen almost 4 years ago

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 what ExtensionUtility::configurePlugin expects.

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');
Actions

Also available in: Atom PDF