Project

General

Profile

Actions

Bug #77884

closed

pi_getLL throws warnings on empty labels

Added by Tizian Schmidlin about 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Start date:
2016-09-08
Due date:
% Done:

0%

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

Description

As stated in #45513, AbstractPlugin::pi_getLL (aka tslib_pi::pi_getLL) throws warnings when a label is set to "empty".

Use case as follows:

plugin.tx_myext._LOCAL_LANG.default.txt1 = Test EN
plugin.tx_myext._LOCAL_LANG.de = Test DE
# This label has to be empty in french
plugin.tx_myext._LOCAL_LANG.fr =

This will generate a warning because of an illegal string offset, and it already was, allegedly, solved in #45513.

My patch proposition:

 public function pi_getLL($key, $alternativeLabel = '', $hsc = false)
    {
        $word = null;
        if (!empty($this->LOCAL_LANG[$this->LLkey][$key][0]['target'])
            || isset($this->LOCAL_LANG_UNSET[$this->LLkey][$key])
        ) {
            // The "from" charset of csConv() is only set for strings from TypoScript via _LOCAL_LANG
            if (isset($this->LOCAL_LANG_charset[$this->LLkey][$key]) && !empty($this->LOCAL_LANG_UNSET[$this->LLkey][$key])) {
                $word = $this->frontendController->csConv($this->LOCAL_LANG[$this->LLkey][$key][0]['target'], $this->LOCAL_LANG_charset[$this->LLkey][$key]);
            } elseif (empty($this->LOCAL_LANG_UNSET[$this->LLkey][$key])) {
                $word = ''; // this is the case where the word gets set to "" 
            }
...

This is for all current TYPO3 versions.

Regards
Tizian

Actions

Also available in: Atom PDF