FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
190 stars 229 forks source link

BUG: Exceptions when using UncacheViewHelper on TYPO3 12 #1894

Open Ceremony64 opened 5 months ago

Ceremony64 commented 5 months ago

I have checked that the bug exists in the dev-development branch Yes

I have checked that there are no already open issues or recently closed issues about this bug Yes

Describe the bug On Typo3, the uncache viewhelper (v:render.uncache) is not working, throwing the following error: FluidTYPO3\Vhs\Utility\RequestResolver::resolveRequestFromRenderingContext(): Return value must be of type TYPO3\CMS\Extbase\Mvc\RequestInterface, TYPO3\CMS\Core\Http\ServerRequest returned

To Reproduce Try rendering a partial template using the v:render.uncache viewhelper in a template on a Typo3 v12 setup.

Expected behavior Show a fresh render of the partial view

Screenshots image

Additional context A patch fixing both the mentioned issue and the subsequent error Given request must have an attribute "extbase" of type ExtbaseAttribute already exists (see #1872) and I can confirm that it fixes the viewhelper on Typo3 v12.

NamelessCoder commented 5 months ago

I need a bit more context. As mentioned in #1872, the ViewHelper has been tested on v12 and is working. There must be something specific about your use case that causes the Request held by RenderingContext to be an unexpected class, so please describe a bit about what you're actually doing.

Ceremony64 commented 5 months ago

No official release nor the current development branch includes the pull request's changes that fixes the viewhelper in typo3 v12. Since there was no coresponding issue to track this bug, I created this one here, in hopes for the pull request to be merged. The pull request #1872 addresses the issues both @sk-foresite and myself ran into when trying the viewhelper on typo3 v12.

So once the mentioned pull request gets merged, this issue would be solved.

NamelessCoder commented 5 months ago

I have to first understand the cause for the issue - like I said, this doesn't happen in the test cases that I have. The pull request as-is cannot be merged since it breaks backwards compatibility but I can't know what the right way to solve that problem is, without first knowing why this appears to be a problem for you and not for me.

And since you posted a screenshot of the error I assume that you've got some use case set up that would trigger the issue. Which is why I asked you (like I also asked @sk-foresite) to provide more information about the context. Otherwise I cannot solve the problem for you!

Ceremony64 commented 5 months ago

The context is in the frontend and the viewhelper is used in a partial template of the websites html templates. Thus it is not used by a content element plugin. Maybe that is what is different?

P.S. I am using the uncache viewhelper to display the name of the logged in user in the header.

NamelessCoder commented 5 months ago

So, sounds like FLUIDTEMPLATE TS object at page level - is Flux's page feature or another third-party ext for page templating involved?

Ceremony64 commented 5 months ago

Correct, FLUIDTEMPLATE at page level. No other templating extension such as Flux nor TemplaVoilà are currently used or even installed

NamelessCoder commented 5 months ago

Thanks - I'll see if I can reproduce it and take it from there!

medarob commented 5 months ago

Not sure if that is related in some way:

Can someone check if there is in error when using the admin panel? We updated to VHS 7 and we got an old error back: https://github.com/FluidTYPO3/vhs/issues/1756#issuecomment-1862874767

Ceremony64 commented 4 months ago

Thanks - I'll see if I can reproduce it and take it from there!

Were you able to replicate the issue?

Ceremony64 commented 4 months ago

I have prepared a new pull request #1898. It fixes this issue and another regression that came with the v7 update, tho it only affected Typo3 v10

It should not break backward compatiblity with both v10 and v11 in either context (with or without extbase)