lochmueller / staticfilecache

🚀 Fastest TYPO3 Extension ever 🚀
https://packagist.org/packages/lochmueller/staticfilecache
GNU General Public License v3.0
117 stars 65 forks source link

Call to undefined method TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getContext() #421

Closed cbaur closed 1 month ago

cbaur commented 1 month ago

Bug Report

Class SFC\Staticfilecache\Cache\Rule\NoWorkspacePreview contains a call to TypoScriptFrontendController::getContext() in line 21. This method has been removed in TYPO3 13.

The full code is:

$tsfe = $GLOBALS['TSFE'] ?? null;
if ($tsfe instanceof TypoScriptFrontendController && $tsfe->getContext()->getPropertyFromAspect('workspace', 'isOffline', false)) {
       $explanation[__CLASS__] = 'The page is in workspace preview mode';
}

As far as I can see, the following function ->getPropertyFromAspect(...) also has been removed from TYPO3 core (as of https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Breaking-102583-RemovedContextAspectTyposcript.html#breaking-102583-removed-context-aspect-typoscript).

Additional note: In my installation the Workspace Sysextension isn't even installed.

Current Behavior The exception provided in this bug reports title is thrown, page is not rendered.

Expected behavior/output Page should render.

Environment

Possible Solution We need to find another way to check if we're in a workspace preview.

Additional context

I am quite surprised this seems not to be a known issue yet, as it happened literally at the first page load after installing TYPO3 13.

chesio commented 1 month ago

I am quite surprised this seems not to be a known issue yet, as it happened literally at the first page load after installing TYPO3 13.

This issue has already been fixed in master branch (see 5580e56952657c6521d6f8d9175bb6d08480b58a). There's just no release with this fix yet.

lochmueller commented 1 month ago

Hey @cbaur

The problem is the global TSFE object and not the context API. The method still exists (your link point to a documentation that typoscript context was dropped and there are no changes in the Methode of the context API).

The problem is fixed in current main branch ( Classes/Cache/Listener/NoWorkspacePreviewListener.php ) and will be part of the next release.

I close this issue...

Regards, Tim