[FOLLOWUP][TASK] Deprecate GeneralUtility:readLLfile 40/41240/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 14 Jul 2015 20:26:32 +0000 (22:26 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 14 Jul 2015 20:36:54 +0000 (22:36 +0200)
ExtensionManager fatals since the parserFactory object is
not always instantiated as expected.

Resolves: #68122
Releases: master
Change-Id: Ibc1ad2ac4df76b80b529c45ab5c1bf83115abf69
Reviewed-on: http://review.typo3.org/41240
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/lang/Classes/LanguageService.php

index 2941e30..037a303 100644 (file)
@@ -407,6 +407,13 @@ class LanguageService {
         * @return array value of $LOCAL_LANG found in the included file, empty if non found
         */
        protected function readLLfile($fileRef) {
+               // @todo: Usually, an instance of the LocalizationFactory is found in $this->parserFactory.
+               // @todo: This is not the case if $GLOBALS['LANG'] is not used to get hold of this object,
+               // @todo: but the objectManager instead. If then init() is not called, this will fatal ...
+               // @todo: To be sure, we always create an instance here for now.
+               /** @var $languageFactory LocalizationFactory */
+               $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
+
                if ($this->lang !== 'default') {
                        $languages = array_reverse($this->languageDependencies);
                } else {
@@ -414,7 +421,7 @@ class LanguageService {
                }
                $localLanguage = array();
                foreach ($languages as $language) {
-                       $tempLL = $this->parserFactory->getParsedData($fileRef, $language, $this->charSet);
+                       $tempLL = $languageFactory->getParsedData($fileRef, $language, $this->charSet);
                        $localLanguage['default'] = $tempLL['default'];
                        if (!isset($localLanguage[$this->lang])) {
                                $localLanguage[$this->lang] = $localLanguage['default'];