Bug #41450

PHP Error when languagePackIndex is empty

Added by Alexander Stehlik almost 10 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Language Manager (backend)
Target version:
-
Start date:
2012-09-28
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

#1

Updated by Gerrit Code Review almost 10 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/15138

#2

Updated by Kai Vogel almost 10 years ago

Note: The problem is already solved in the new language module in TYPO3 version 6.0. See http://forge.typo3.org/issues/39963.

#3

Updated by Alexander Stehlik almost 10 years ago

Hi Kai,

thanks for the reply.

I'm using the lang module in the current master (all submodules updated) and I'm getting this error.

Am I using the newest version or is it available somewhere else?

Kind regards,
Alex

#4

Updated by Kai Vogel almost 10 years ago

Hi Alex, the changes are currently waiting to be merged, therefore they are not yet present in the trunk. See: https://review.typo3.org/#/c/14683/

#5

Updated by Alexander Stehlik almost 10 years ago

Hi Kai,

OK, the patch fixes the issue.

I'm a bit unsure if I should abandon my patch because in my eyes it solves a general problem in the XML parser (TYPO3\CMS\Lang\Utility\Connection\Ter::parseL10nXML($string)) with handling empty tags.

When you think it is obsolete you can close the issue and I'll abandon the patch.

Kind regards,
Alex.

#6

Updated by Gerrit Code Review almost 10 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/15138

#7

Updated by Kai Vogel almost 10 years ago

  • Status changed from New to Under Review
  • Assignee set to Kai Vogel

The problem is that the functionality has changed. A check with "isset()" now returns FALSE because the value will never been set if it's empty or contains only spaces. It is necessary to make sure that nothing gets broken with this change.

#8

Updated by Alexander Stehlik almost 10 years ago

Hi Kai,

I just did a quick search through the files. It seems \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility\Ter::fetchTranslationStatus() is only used in the LanguageController (in the current master with the patch for #39963 applied). This method is the only one that uses the parseL10nXML() method.

Kind regards,
Alex

#9

Updated by Kai Vogel over 9 years ago

  • Status changed from Under Review to Accepted

For me it's ok.

#10

Updated by Kai Vogel over 9 years ago

  • Status changed from Accepted to Under Review
#11

Updated by Oliver Hader over 9 years ago

  • Target version set to 2222
#12

Updated by Oliver Hader over 9 years ago

  • Project changed from 2315 to TYPO3 Core
#13

Updated by Oliver Hader over 9 years ago

  • Category set to Language Manager (backend)
#14

Updated by Oliver Hader over 9 years ago

  • Target version deleted (2222)
#15

Updated by Gerrit Code Review about 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/15138

#16

Updated by Gerrit Code Review over 8 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/15138

#17

Updated by Gerrit Code Review over 8 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/15138

#18

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26902

#19

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26903

#20

Updated by Alexander Stehlik over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#21

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF