Issue Bug Closed

#77884pi_getLL throws warnings on empty labels

Tizian Schmidlin 09/08/16, 11:59 updated 04/23/19, 07:12

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

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.