Project

General

Profile

Actions

Bug #95281

closed

Form values from submitted data are missing when validation fails

Added by Frederik Schaller about 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2021-09-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Hi,

During tests with our extension and TYPO3 v11.4 we have identified a bug that already entered data in a from is missing when the validation fails and the ErrorAction triggers a ForwardResponse.

The ViewHelper method getValueAttribute looks for already submitted form data. I've found out that the OriginalRequest ($this->renderingContext->getRequest()->getOriginalRequest()->getArguments()) did not had any of the entered data.

When looking into the Dispatchers.php the method buildRequestFromCurrentRequestAndForwardResponse clones the $currentRequest into the $request variable.

        $request = clone $currentRequest;

...

        if ($forwardResponse->getArguments() !== null) {
            $request->setArguments($forwardResponse->getArguments());
        }

I recognised that the setArguments method on the $request arguments does also change the $currentRequest object, which results in loosing the OriginalRequests payload. I assume that this is the reason, why the getValueAttribute does not find any values and does not enrich the form.

For testing purposes I've commented out

<!--
        if ($forwardResponse->getArguments() !== null) {
            $request->setArguments($forwardResponse->getArguments());
        }
-->

This leads to a new behaviour because the initial action gets now an invalidated object (which is fine) but was not the case with TYPO v10 (the model was there NULL).

Thanks for looking into this.
Frederik


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #95095: Properties of Extbase OriginalRequest get overwritten on forwardClosed2021-09-03

Actions
Actions

Also available in: Atom PDF