Issue Details (XML | Word | Printable)

Key: ZF-3164
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Thomas Weidner
Reporter: Chris Abernethy
Votes: 4
Watchers: 6
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Validate messageTemplate keys are not all unique.

Created: 22/Apr/08 07:52 PM   Updated: 29/Aug/09 01:45 AM   Resolved: 29/Aug/09 01:45 AM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Validate
Affects Version/s: 1.5.1
Fix Version/s: 1.10.0

Time Tracking:
Not Specified

Issue Links:
Dependency
 
Duplicate
 
Related
 


 Description  « Hide

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

etc.

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



Wil Sinclair added a comment - 09/Jun/08 01:53 PM

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


Thomas Weidner added a comment - 08/Nov/08 06:43 AM

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.


Thomas Weidner added a comment - 15/Dec/08 12:18 PM

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.


Thomas Weidner added a comment - 15/Dec/08 12:19 PM

Assigned to Matthew after a discussion in #zftalk


Thomas Weidner added a comment - 11/Mar/09 01:43 PM

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.


Leandro Rodrigues Chaves added a comment - 03/May/09 04:29 PM

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.


Thomas Weidner added a comment - 03/May/09 10:56 PM

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.

Thomas Weidner added a comment - 29/Aug/09 01:45 AM

Probably fixed with r17874 for ZF 1.10