ZF-3164: Zend_Validate messageTemplate keys are not all unique.

Issue Type: Bug Created: 2008-04-22T19:52:43.000+0000 Last Updated: 2009-08-29T01:45:46.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Chris Abernethy (brownoxford) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: - ZF-2397



Several Zend_Validate sub-classes use non-unique messageTemplate keys, making it impossible to provide translations.

'invalid' Zend_Validate_Barcode_UpcA Zend_Validate_Barcode_Ean13

'invalidLength' Zend_Validate_Barcode_UpcA Zend_Validate_Barcode_Ean13

'stringEmpty' Zend_Validate_Alpha Zend_Validate_Alnum Zend_Validate_Digits

Since the messageTemplate keys are what is used to look up translation strings, these cannot all be translated properly. Implementing standard practice of prefixing these keys with a class name would help resolve the issue, but could break existing setups, ie:

barcodeUpcAInvalid barcodeEan13Invalid barcodeUpcAInvalidLength barcodeEan13InvalidLength alphaStringEmpty alnumStringEmpty digitsStringEmpty


Many others are not currently prefixed in this way, but are still unique and so do not trigger this issue at present.


Posted by Wil Sinclair (wil) on 2008-06-09T13:53:31.000+0000

If we'd like to address this, maybe we can coordinate with Thomas on it?

Posted by Thomas Weidner (thomas) on 2008-11-08T06:43:13.000+0000

I assigned it to me due to Wil's last comment.

Has to be discussed with the dev-team as it would be a BC break.

Posted by Thomas Weidner (thomas) on 2008-12-15T12:18:38.000+0000

I propose to make a sort of standard for keys. A working solution would be to name the keys like: - classError

For example: barcodeUpcInvalid barCodeEanInvalid stringLengthInvalid

and so on. I think you get an idea.

Posted by Thomas Weidner (thomas) on 2008-12-15T12:19:35.000+0000

Assigned to Matthew after a discussion in #zftalk

Posted by Thomas Weidner (thomas) on 2009-03-11T13:43:16.000+0000

Issue has been postponed until 2.0 after a discussion with the dev-team. Reason is that the fix for this issue would be a BC break.

Posted by Leandro Rodrigues Chaves (leandrorc) on 2009-05-03T16:29:38.000+0000

Yeah, but i think dev-team could solve this right now, solving the BC issue just by keeping both old and new message keys and discouraging using of old message keys, and then removing them in 2.0.

Posted by Thomas Weidner (thomas) on 2009-05-03T22:56:12.000+0000

This has already been discussed in past. Adding old and new messages raises unsolvable problems because it's not possible to have two messages available for the same error.

  • Which one of the messages should be thrown ? The new ones, or the old ones ?
  • Adding translation, as mentioned in ZF-3920, does not work, as both messages contain the same content/messageId.

Posted by Thomas Weidner (thomas) on 2009-08-29T01:45:46.000+0000

Probably fixed with r17874 for ZF 1.10

Have you found an issue?

See the Overview section for more details.


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

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