Issue Bug Closed

#41450PHP Error when languagePackIndex is empty

Alexander Stehlik 09/28/12, 13:59 updated 10/02/18, 12:16

Description

I tried to update the language packs and got this PHP error:

> Fatal error: Cannot use string offset as an array in typo3/sysext/lang/Classes/Controller/LanguageController.php on line 208

The problem occurs, if the languagePackIndex is empty (see http://ter.rz.tu-clausthal.de/ter/c/o/core-l10n/core-l10n.xml for example):

<?xml version="1.0" standalone="yes" ?>
<TERlanguagePackIndex>
    <meta>
        <timestamp>1348788881</timestamp>
        <date>2012-09-28 01:34:41</date>
    </meta>
    <languagePackIndex>
    </languagePackIndex>
</TERlanguagePackIndex>

The problem is in the XML parser in TYPO3\CMS\Lang\Utility\Connection\Ter::parseL10nXML($string). It will fill the tag with a string containing the space / linebreaks between the two languagePackIndex XML tags. The isset() check in TYPO3\CMS\Lang\Controller\LanguageController::checkTranslationForExtension($languages, $extensionKey) therefore returns TRUE which results in the error above.

Reviews 3