Issues

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

Issue Type: Bug Created: 2009-08-11T04:31:24.000+0000 Last Updated: 2009-08-22T15:23:08.000+0000 Status: Resolved Fix version(s): - 1.9.2 (25/Aug/09)

Reporter: Jan Gorman (polygraf) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments:

Description

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.

Comments

Posted by Thomas Weidner (thomas) on 2009-08-22T14:35:12.000+0000

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

Posted by Jan Gorman (polygraf) on 2009-08-22T15:14:15.000+0000

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

Posted by Thomas Weidner (thomas) on 2009-08-22T15:23:07.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts