Bug #105325
openNested StandaloneView (FluidTemplate) inherits Extbase request from TemplateView
0%
Description
Setup¶
Extbase Extension with a Controller "Seminars" and an action "Show".
The corresponding "Show.html" Fluid template contains:
<f:cObject typoscriptObjectPath="lib.someContent">
So it renders some regular content:
lib.someContent < styles.content.get
lib.someContent.select.pidInList = 123
Expected behavior¶
Browser should display the content loaded via lib.someContent.
This works just fine up to v11.
Actual behavior¶
Exception that "Seminars/Show.html" can't be found in paths. (where the paths are the regular Fluid Styled Content paths)
Analysis¶
The Fluid template setup above creates technically a nesting of TemplateView (Show-Action) and StandaloneView (FluidTemplate via f:cObject).
Unluckily, the StandaloneView gets passed the Extbase-Request from the Show-Action, which causes this request being passed down to the TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::setRequest
causing the Controller/Action of the FluidTemplate to be overwritten.
While it is desirable that StandaloneView itself can handle Extbase Requests for other use cases like E-Mail and stuff, this should not be the case when an isolated context is required, like in the f:cObject case.
Ideas for solution¶
Fix CObjectViewHelper to "revert" the request properly, e.g. by using the initial requst from $GLOBALS[TYPO3_REQUEST] instead of the more specific one in its own renderingContext.
Updated by Markus Klein 3 months ago ยท Edited
Probably better change in the viewhelper
- $request = $renderingContext->getRequest();
+ $request = $renderingContext->getRequest()->withoutAttribute('extbase');
Updated by Garvin Hicking 3 months ago
- Related to Feature #104773: Implement and use a core ViewFactoryInterface added
Updated by Markus Klein 3 months ago
The fix above works for v12, I'll try to do some testing in v13 too.
Updated by Gerrit Code Review 3 months ago
- Status changed from New to Under Review
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86633
Updated by Gerrit Code Review 3 months ago
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86828
Updated by Gerrit Code Review 3 months ago
Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86633