ZF-7560: Zend_Translate_Adapter does not properly handle numeric key values


I have come across an issue in Zend_Translate_Adapter with the use of numeric keys in a translation file. In the translation file (CSV) I have a couple of keys for translating formRadio-Labels:

4;Vor mehr als 4 Wochen 2;Vor weniger als 4 Wochen 0;Neueinzug

In Zend_Translate_Adapter the keys get mangled up, I have tracked the issue down to the use of {{array_merge}} on Line 481 in the method {{_addTranslationData}}

{{$this->_translate[$key] = array_merge($this->_translate[$key], $temp[$key]);}}

{{array_merge}} does not preserve numeric key values. The issue could be fixed by changing the line to

{{$this->_translate[$key] = $this->_translate[$key] + $temp[$key];}}

Using the union operator, the translation works fine again.


And you know that using numeric keys for translation is a absolute no go and not supported ?

No, I didn't know that and it worked just fine in every version up to 1.8.4pl1

Fixed with r17760. Note that using numeric keys for translation is a VERY unsave behaviour. Strongly discuraged.