Project

General

Profile

Actions

Bug #90422

closed

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

Added by Christian Eßl over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2020-02-18
Due date:
% Done:

100%

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

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

Also available in: Atom PDF