Bug #95281
closedForm values from submitted data are missing when validation fails
0%
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
Updated by Torben Hansen about 3 years ago
- Related to Bug #95095: Properties of Extbase OriginalRequest get overwritten on forward added
Updated by Torben Hansen about 3 years ago
Does this patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/71133 resolve your problem?
Updated by Frederik Schaller about 3 years ago
Torben Hansen wrote in #note-2:
Does this patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/71133 resolve your problem?
Yes. Thank you very much!
Updated by Benni Mack about 3 years ago
- Target version changed from 11 LTS to Candidate for patchlevel