Commit b6c2a5ea authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Christian Kuhn
Browse files

[BUGFIX] Use ForwardResponse arguments if not null

Issue #92815 introduced a regression which triggered an endless
recursion in case of a validation error.

A bit longer explanation:

Given there is an extbase controller action with an argument
whose properties have to validated, extbase maps the incoming
data of the request onto the internally handled arguments
object which then performs the validation on all given arguments.

In case of an error, extbase tries to redirect to the referring
request aka the current request with an updated set of arguments.
The idea is to remove all arguments of the current request to not
trigger the same validation error again on the next try.

There was a condition in the past which eventually led to the
overriding of current arguments which was refactored wrong.

The solution is to make the arguments of the ForwardResponse null
by default and have the same null check like before.

Releases: master
Resolves: #94457
Change-Id: I1701001ce0cf55df79b2ed896d69a08659a2902b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70020

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: waldhacker's avatarwaldhacker <hello@waldhacker.dev>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: waldhacker's avatarwaldhacker <hello@waldhacker.dev>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 29fb5f52
......@@ -25,7 +25,7 @@ class ForwardResponse extends Response
private string $actionName;
private ?string $controllerName = null;
private ?string $extensionName = null;
private array $arguments = [];
private ?array $arguments = null;
private Result $argumentsValidationResult;
public function __construct(string $actionName)
......@@ -73,7 +73,7 @@ class ForwardResponse extends Response
public function withoutArguments(): self
{
$clone = clone $this;
$this->arguments = [];
$this->arguments = null;
return $clone;
}
......@@ -99,7 +99,7 @@ class ForwardResponse extends Response
return $this->extensionName;
}
public function getArguments(): array
public function getArguments(): ?array
{
return $this->arguments;
}
......
......@@ -160,7 +160,7 @@ class Dispatcher implements SingletonInterface
$request->setControllerExtensionName($forwardResponse->getExtensionName());
}
if ($forwardResponse->getArguments() !== []) {
if ($forwardResponse->getArguments() !== null) {
$request->setArguments($forwardResponse->getArguments());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment