Actions
Bug #77884
closedpi_getLL throws warnings on empty labels
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
Updated by Riccardo De Contardi about 6 years ago
The use case in description seems wrong; I think it should be:
plugin.tx_myext._LOCAL_LANG.default.txt1 = Test EN plugin.tx_myext._LOCAL_LANG.de.txt1 = Test DE # This label has to be empty in french plugin.tx_myext._LOCAL_LANG.fr.txt1 =
I tried with a multilanguage system (italian (default), english (L=1) ) on TYPO3 8.7.19 and the latest EXT:news extension
TS Setup:
plugin.tx_news._LOCAL_LANG.default.more-link = A TEST LABEL plugin.tx_news._LOCAL_LANG.it.more-link =
Results:¶
the label in italian disappears, the same behavior described here: https://forge.typo3.org/issues/43959#note-8 . I have seen no warnings (on log module).
Updated by Stephan Großberndt almost 6 years ago
- Status changed from New to Needs Feedback
Updated by Benni Mack over 5 years ago
- Target version changed from next-patchlevel to Candidate for patchlevel
Updated by Benni Mack over 5 years ago
- Status changed from Needs Feedback to Closed
No feedback, but works as expected, and no warning was thrown - will close.
Actions