Actions
Bug #61999
closedSmall bug in sysext/lang/Classes/LanguageService.php
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']; } }
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
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
Updated by Markus Klein about 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 9522a9e0ed61ff292e2c1a09022afafc11babd97.
Actions