Issue Bug Closed

#90422ActionController::redirect() without action argument causes exception in master

Christian Eßl 02/18/20, 18:06 updated 04/01/20, 21:14

Description

Regression introduced with #87598.
ExtensionService::getPluginNameByAction() now requires the arguments as strings:

public function getPluginNameByAction($extensionName, string $controllerName, string $actionName): ?string
    {

Both in ActionController::redirect() and UriBuilder::uriFor() you could (and can still) leave out all the arguments and make them null.

Before you could write a redirect like this, leaving out the action:

$this->redirect(
                null, // $actionName
                null, // $controllerName
                null, // $extensionName
                null, // $arguments
                1
            );

which would create a valid redirect to page 1. Now it will trigger the following error:

Argument 3 passed to TYPO3\CMS\Extbase\Service\ExtensionService::getPluginNameByAction() must be of the type string, null given, called in /var/www/html/typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php on line 579
There are two options:
  • Make the $actionName argument in ExtensionService of type ?string, preserving the old behaviour.
  • Or change the ActionController::redirect() method to require giving it an action name. (Would have to be checked inside the method as the action can either be given in $actionName or $arguments)

Reviews 1