Zend Framework

Zend_Validate messageTemplate keys are not all unique.

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.1
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Validate
  • Labels:
    None

Description

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.

Issue Links

Activity

Hide
Wil Sinclair added a comment -

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

Show
Wil Sinclair added a comment - If we'd like to address this, maybe we can coordinate with Thomas on it?
Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.
Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.
Hide
Thomas Weidner added a comment -

Assigned to Matthew after a discussion in #zftalk

Show
Thomas Weidner added a comment - Assigned to Matthew after a discussion in #zftalk
Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.
Hide
Leandro Rodrigues Chaves added a comment -

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.

Show
Leandro Rodrigues Chaves added a comment - 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.
Hide
Thomas Weidner added a comment -

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.
Show
Thomas Weidner added a comment - 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.
Hide
Thomas Weidner added a comment -

Probably fixed with r17874 for ZF 1.10

Show
Thomas Weidner added a comment - Probably fixed with r17874 for ZF 1.10

People

Vote (4)
Watch (6)

Dates

  • Created:
    Updated:
    Resolved: