Actions
Bug #98992
closedform DataStructureIdentifierHook uses $GLOBALS['LANG'] which may not be initialized
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2022-11-03
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
I noticed $GLOBALS['LANG'] may not be initialized in some contexts, this is also mentioned in LanguageService:
* Usually this is injected into $GLOBALS['LANG'] when in backend or CLI context, and * populated by the current backend user. Don't rely on $GLOBAL['LANG'] in frontend, as it is only * available in certain circumstances! * In Frontend, this is also used to translate "labels", see TypoScriptFrontendController->sL() * for that.
We are not in Frontend, but somehow it is not initialized in my case either (when running an Upgrade Wizard in the BE).
I have an Upgrade wizard which wants to migrate some Flexforms. I use FlexFormTools::cleanFlexFormXML which instantiate the DataStructureIdentifierHook which will throw an exception in the constructor because $GLOBALS['LANG'] is null.
It calls- TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools::cleanFlexFormXML
- which calls the TYPO3\CMS\Form\Hooks\DataStructureIdentifierHook constructor
- which calls $this->getLanguageService()
- which tries to return $GLOBALS['LANG']
EXT:form is installed here but it is not relevant at all to the Flexforms which are to be converted.
see attached stackdump file
Files
Actions