Project

General

Profile

Actions

Bug #61999

closed

Small bug in sysext/lang/Classes/LanguageService.php

Added by Thomas Candrian about 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-10-02
Due date:
% Done:

100%

Estimated time:
0.00 h
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

In sysext/lang/Classes/LanguageService.php line 233 (TYPO3 6.2.5):

    public function getLL($index, $hsc = FALSE) {
            // Get Local Language
        if (isset($GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'])) {
            $output = $GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'];
        } else {
            $output = $GLOBALS['LOCAL_LANG']['default'][$index][0]['target'];
        }

may fail if $index is not set to an existing element of the array. Better would be something like this (or even better an appropriate error handling ?!?):

    public function getLL($index, $hsc = FALSE) {
            // Get Local Language
        if (isset($GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'])) {
            $output = $GLOBALS['LOCAL_LANG'][$this->lang][$index][0]['target'];
        } else {
            if (!isset($GLOBALS['LOCAL_LANG']['default'][$index][0]['target'])){
                $output = "??";
            } else {
                $output = $GLOBALS['LOCAL_LANG']['default'][$index][0]['target'];
            }
        }
Actions #1

Updated by Markus Klein about 10 years ago

Well, changing the behavior, which is here for a very long time, will not make the users happy.
I agree a proper check must be added, but the returned value should be empty.

You can enable the debugging to see if you've missing labels somewhere.

$GLOBALS['TYPO3_CONF_VARS']['BE']['lang']['debug'] = 1

Actions #2

Updated by Gerrit Code Review about 10 years ago

  • Status changed from New to Under Review

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

Actions #3

Updated by Markus Klein about 10 years ago

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

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF