Bug #68903
closed
indexed_search plugin throws uncatchable fatal error if not logged in in backend
Added by Philipp Wrann over 9 years ago.
Updated about 6 years ago.
Description
Just updated to 7.4
If i open a page, that contains a plugin of type indexed_search it throws an error:
Fatal error: Call to a member function includeLLFile() on null in ...typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php on line 185
So it seems $GLOBALS['LANG'] is not set
If i am logged in in backend and preview the page it works. It seems like initializeLanguageObject never happens in FE context, but its just a shot in the dark.
Files
TYPO3\CMS\Frontend\Http\RequestHandler only loads the language object if the admPanel is loaded, so that explains my situation - but is that intended to be so? I think the $GLOBALS['LANG'] variable might be used in various extensions and scripts.
- Is Regression changed from No to Yes
Is this going to be fixed soon? I am running 7.4 in one production environment :(
Hello Philipp,
Maybe this fix will help you, I had the same problem. The fix works when logged out, but when logged in to the same browser, the front-end languages remain on the default language.
In SearchFormController.php
typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php
Change this starting at line 2372:
protected function getLanguageService() {
return $GLOBALS['LANG'];
}
to this:
protected function getLanguageService() {
if (!is_object($GLOBALS['LANG'])) {
$GLOBALS['LANG'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
$GLOBALS['LANG']->init($GLOBALS['TSFE']->config['config']['language']);
}
return $GLOBALS['LANG'];
}
- Status changed from New to Resolved
- Status changed from Resolved to Closed
Also available in: Atom
PDF