#95095Properties of Extbase OriginalRequest get overwritten on forward
Description
Propably with the change #94428 the behavior of a ForwardRequest in Extbase changed. In TYPO3\CMS\Extbase\Mvc\Dispatcher::buildRequestFromCurrentRequestAndForwardResponse(Request $currentRequest, ForwardResponse $forwardResponse) the given $currentRequest is cloned to $request variable and next controller name, extension name and arguments get set for the cloned request object .
Since the cloned request object internally holds a reference to original the PSR-7 request, controller name, extension name and arguments actually get overwritten with data from the forwarded request.
To visualize this, please see the following screenshots.
current-request-before.png
This is the state right after $currentRequest is cloned to $request. Note, that arguments in ExtbaseRequestParameters contains 4 items.
current-request-after.png
This is the state of $currentRequest after controller name, extension name and arguments were changed in $request. So basically we loose important information about the original request here.
It seems to me, that this new behavior is unintended any may lead to problems for extension authors relying on data in OriginalRequest