Project

General

Profile

Actions

Bug #61999

closed

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

Added by Thomas Candrian over 9 years ago. Updated over 5 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

Also available in: Atom PDF