Bug #20219
closedLOCAL_LANG default values are overwritten by localized text
0%
Description
Consider the following XML (see XML-file attached):
<T3locallang>
<meta type="array">
<type>module</type>
<description>Language labels for testing purposes</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="button1">Button 1 - Description (EN)</label>
<label index="button2">Button 2 - Description (EN)</label>
<label index="button3">Button 3 - Description (EN)</label>
</languageKey>
<languageKey index="fr" type="array">
<label index="button1">Button 1 - Description (FR)</label>
<label index="button2">Button 2 - Description (FR)</label>
</languageKey>
</data>
</T3locallang>
When tring to get the french Label for Button 3, you expect to receive "Button 3 - Description (EN)", since there is no french localized label for Button 3.
Instead you get "Button 2 - Description (FR)".
The last default value, is always replaced by the last localized value (see Screenshot).
This is caused by the readLLXMLfile-function. The function iterates through the $LOCAL_LANG['default'] values by assigning by reference to $labelValue (line 4186).
Since $labelValue is not unset later, the reference will stay on the last value of $LOCAL_LANG['default']. Later then $labelValue is used again to iterate through $LOCAL_LANG[$langKey], and it then overwrites the last value in $LOCAL_LANG['default'] since the reference is still intact.
(issue imported from #M10742)
Files