FluidTYPO3 / vhs

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

Call to undefined method TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext() #1783

Closed bavarianbytes closed 2 years ago

bavarianbytes commented 2 years ago

v:condition.context.isDevelopment in TYPO3 11 seems to use deprecated method and causes this exception in ext/vhs/Classes/ViewHelpers/Condition/Context/IsDevelopmentViewHelper.php line 32: Call to undefined method TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext()

mediaessenz commented 2 years ago

I can confirm this issue.

Return statement of Classes/ViewHelpers/Condition/Context/IsDevelopmentViewHelper.php should be

return (class_exists(Environment::class) ? Environment::getContext()->isDevelopment() : GeneralUtility::getApplicationContext()->isDevelopment());

Same problem exist in IsProductionViewhelper ...

In this case the return statement should be:

return (class_exists(Environment::class) ? Environment::getContext()->isProduction() : GeneralUtility::getApplicationContext()->isProduction());

... and isTestingViewHelper.

This is how it should look like:

return (class_exists(Environment::class) ? Environment::getContext()->isTesting() : GeneralUtility::getApplicationContext()->isTesting());