You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This one's a bit complicated but stay with me. I came across this problem for more than 10 times in different projects, and debugging is not easy, but i will it explain as good as possible.
The cases, where i stumbled over this problem are diverse, and the easiest way to reproduce it may not make sense in terms of the use case. The bug can be triggered by other hooks/events. This is not a problem with the yoast_seo extension, i am only using it to show, that the problem exists.
To Reproduce
Steps to reproduce the behavior:
Install yoast-seo-for-typo3/yoast_seo
Create s site configuration with a root page, that does not (yet) exist
Open the solr info backend module
You will see the exception: YoastSeoForTypo3\YoastSeo\StructuredData\StructuredDataProviderManager::getTypoScriptFrontendController(): Return value must be of type TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController, null returned
Expected behavior
Invalid site configuration must not lead to an exception, which translates technically to:
The solr extension must not trigger code in the backend that modifies the global state to contain a request with applicationType FE
Root cause analysis
\ApacheSolrForTypo3\Solr\Controller\Backend\Search\AbstractModuleController::initializeAction calls \ApacheSolrForTypo3\Solr\Controller\Backend\Search\AbstractModuleController::autoSelectFirstSiteAndRootPageWhenOnlyOneSiteIsAvailable
That method searches for all sites and "initializes" the site with \ApacheSolrForTypo3\Solr\FrontendEnvironment\Tsfe::initializeTsfe.
If the page does not exist, the page not found handler will be called, which subsequently results in a the call \TYPO3\CMS\Frontend\Middleware\TypoScriptFrontendInitialization::process, which sets $GLOBALS['TYPO3_REQUEST'] = $request;, but the request is a manually created request with applicationType FE. Here, the global state of the application is changed.
Later on, when the ModuleTemplate is initialized and PageRenderer hooks are called, the variable $GLOBALS['TYPO3_REQUEST'] is still set to a request with applicationType FE, which creates these problems.
I have some thoughts on this, but no clear solution.
Never initialize all Sites. TYPO3 instances can have an arbitrary number of sites (~40) in my case, which makes the initialization very slow.
In previous EXT:solr versions, if no page was selected or the selected page did not have a site root in its root line, a message "please select a page" was displayed, which was absolutely fine.
Initializing TSFE in the backend has always been a bad idea and source of errors and other problems. There should be another way to achieve what \ApacheSolrForTypo3\Solr\FrontendEnvironment\Tsfe::initializeTsfe is trying to do.
Used versions (please complete the following information):
TYPO3 Version: 12.4
Browser: any
EXT:solr Version: 12.0.2
Used Apache Solr Version: 11.0
PHP Version: 8.1-8.3
The text was updated successfully, but these errors were encountered:
This one's a bit complicated but stay with me. I came across this problem for more than 10 times in different projects, and debugging is not easy, but i will it explain as good as possible.
The cases, where i stumbled over this problem are diverse, and the easiest way to reproduce it may not make sense in terms of the use case. The bug can be triggered by other hooks/events. This is not a problem with the yoast_seo extension, i am only using it to show, that the problem exists.
To Reproduce
Steps to reproduce the behavior:
yoast-seo-for-typo3/yoast_seo
YoastSeoForTypo3\YoastSeo\StructuredData\StructuredDataProviderManager::getTypoScriptFrontendController(): Return value must be of type TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController, null returned
Expected behavior
Invalid site configuration must not lead to an exception, which translates technically to:
Root cause analysis
\ApacheSolrForTypo3\Solr\Controller\Backend\Search\AbstractModuleController::initializeAction
calls\ApacheSolrForTypo3\Solr\Controller\Backend\Search\AbstractModuleController::autoSelectFirstSiteAndRootPageWhenOnlyOneSiteIsAvailable
That method searches for all sites and "initializes" the site with
\ApacheSolrForTypo3\Solr\FrontendEnvironment\Tsfe::initializeTsfe
.If the page does not exist, the page not found handler will be called, which subsequently results in a the call
\TYPO3\CMS\Frontend\Middleware\TypoScriptFrontendInitialization::process
, which sets$GLOBALS['TYPO3_REQUEST'] = $request;
, but the request is a manually created request with applicationType FE. Here, the global state of the application is changed.Later on, when the
ModuleTemplate
is initialized and PageRenderer hooks are called, the variable$GLOBALS['TYPO3_REQUEST']
is still set to a request with applicationType FE, which creates these problems.I have some thoughts on this, but no clear solution.
\ApacheSolrForTypo3\Solr\FrontendEnvironment\Tsfe::initializeTsfe
is trying to do.Used versions (please complete the following information):
The text was updated successfully, but these errors were encountered: