Zend Framework

Zend_Form_Element overrides Zend_Validate DefaultTranslator

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.10.4
  • Fix Version/s: 1.10.5
  • Component/s: Zend_Translate
  • Labels:
    None

Description

cf ZF-9275 comments for a complete description of the problem including the defective source code.

The issue in ZF-9275 has not been fixed because of a bug in Zend/Form.php

Zend_Translate registry is set automatically by the resource method getTranslate
This in turn sets the translator for elements in Zend/Form/isValid() via the getDefaultTranslator method.
Since the element translator is initialized the Zend_Validate_Abstract default translator cannot be used.

Hence, the files in resources/languages/xx/Zend_Validate.php cannot be used normally unless using one of those workarounds:

  • setting the validator translator file to Zend_Form default translators.
  • disabling the Zend_Translate registry setting.

We should not see the forms elements translators override the validators translators since they address different translation sentences.

Activity

Hide
Thomas Weidner added a comment -

Sorry, but I don't see why this should be a problem of Zend_Translate?
Zend_Translate can not affect how other components behave.

Show
Thomas Weidner added a comment - Sorry, but I don't see why this should be a problem of Zend_Translate? Zend_Translate can not affect how other components behave.
Hide
Dominique Lorre added a comment -

It is a problem with 'Zend_Translate' registry key, not Zend/Translate.php

Show
Dominique Lorre added a comment - It is a problem with 'Zend_Translate' registry key, not Zend/Translate.php
Hide
Dominique Lorre added a comment -

The affected files are:
library/Zend/Form.php
library/Zend/Form/Element.php
resources/languages/??/Zend_Validate.php
library/Zend/Application/Resource/Translate.php

Show
Dominique Lorre added a comment - The affected files are: library/Zend/Form.php library/Zend/Form/Element.php resources/languages/??/Zend_Validate.php library/Zend/Application/Resource/Translate.php
Hide
Thomas Weidner added a comment -

And why should Zend_Translate not use the registry key "Zend_Translate" ??

Zend_Cache uses the registry key "Zend_Cache"...
Zend_Locale uses the registry key "Zend_Locale"...

Generally all registry keys with "Zend_" are reserved for Zend_ component usage.

I still don't see the problem with Zend_Translate.

Show
Thomas Weidner added a comment - And why should Zend_Translate not use the registry key "Zend_Translate" ?? Zend_Cache uses the registry key "Zend_Cache"... Zend_Locale uses the registry key "Zend_Locale"... Generally all registry keys with "Zend_" are reserved for Zend_ component usage. I still don't see the problem with Zend_Translate.
Hide
Dominique Lorre added a comment -

I did not say it has to be deleted I say it has to stop overriding Zend_Validate_Abstract default translator.

Zend_Translate being set generates a bug which makes Zend_Form_Element translator override Zend_Validate_Abstract default translator. That doesn't mean it should be unset, only that the bug should be fixed.

Sorry this bug does not belong to only one component, it is an intricated bug that starts from the Boostrap and ends in Zend_Form/Element.

The way translators are handled is defective and leads to numerous problems since the approach is to give priority to some translators over others instead of a parallel approach which would favor reusability.

There should be a 'Zend_Translate' registry key only as a fallback, not something that would override other settings such as Zend_Validate_Abstract default translators.

Show
Dominique Lorre added a comment - I did not say it has to be deleted I say it has to stop overriding Zend_Validate_Abstract default translator. Zend_Translate being set generates a bug which makes Zend_Form_Element translator override Zend_Validate_Abstract default translator. That doesn't mean it should be unset, only that the bug should be fixed. Sorry this bug does not belong to only one component, it is an intricated bug that starts from the Boostrap and ends in Zend_Form/Element. The way translators are handled is defective and leads to numerous problems since the approach is to give priority to some translators over others instead of a parallel approach which would favor reusability. There should be a 'Zend_Translate' registry key only as a fallback, not something that would override other settings such as Zend_Validate_Abstract default translators.
Hide
Thomas Weidner added a comment -

Closing as non issue.

You noted that Zend_Translate behaves buggy but you can not provide a usecase which shows this behaviour even after several replies.

Zend_Translate has nothing to do with the resources, Zend_Form, Zend_Validate or Zend_Application.

All of these classes which were mentioned make use of Zend_Translate and not reverse.

Zend_Translate itself can not affect how it is used by others or how other components behave. There is no way how Zend_Translate can change the usage of it's own registry key when this key is used by other components in an unexpected way.

Show
Thomas Weidner added a comment - Closing as non issue. You noted that Zend_Translate behaves buggy but you can not provide a usecase which shows this behaviour even after several replies. Zend_Translate has nothing to do with the resources, Zend_Form, Zend_Validate or Zend_Application. All of these classes which were mentioned make use of Zend_Translate and not reverse. Zend_Translate itself can not affect how it is used by others or how other components behave. There is no way how Zend_Translate can change the usage of it's own registry key when this key is used by other components in an unexpected way.
Hide
Dominique Lorre added a comment -

As mentioned before, you have the full description of the bug in ZF-9275 comments. The day you will use the components you design you will see what the problem is. As for me, I'm done reporting bugs for you.

Show
Dominique Lorre added a comment - As mentioned before, you have the full description of the bug in ZF-9275 comments. The day you will use the components you design you will see what the problem is. As for me, I'm done reporting bugs for you.
Hide
Thomas Weidner added a comment -

ZF-9275 is a bug of Zend_Form, not Zend_Translate.
I don't see how I can affect how Zend_Form behaves by changing Zend_Translate.

I am maintainer of Zend_Translate. And you stated in your issue and your second reply that there is a failure within Zend_Translate. When you see a bug within Zend_Form then you please add a issue for the this component with some code for reproducation and not for another component.

Note that I did not design Zend_Form. This is an "open source framework". Which means that people like me are giving their sparetime for others like you. I am not paid for this service nor for my sparetime. So there is no reason to get nasty.

Show
Thomas Weidner added a comment - ZF-9275 is a bug of Zend_Form, not Zend_Translate. I don't see how I can affect how Zend_Form behaves by changing Zend_Translate. I am maintainer of Zend_Translate. And you stated in your issue and your second reply that there is a failure within Zend_Translate. When you see a bug within Zend_Form then you please add a issue for the this component with some code for reproducation and not for another component. Note that I did not design Zend_Form. This is an "open source framework". Which means that people like me are giving their sparetime for others like you. I am not paid for this service nor for my sparetime. So there is no reason to get nasty.
Hide
Dominique Lorre added a comment -

You are the maintainer of Zend_Translate then do me a favor: explain to other maintainers that there is no such things as 'priority' in translations. When a sentence is translated right I want to reuse it not see another translation override something that works.

You are giving free time I'm grateful because that bug is over 3 monthes old and still not fixed, yet it is classified as RESOLVED. People would be fired for that in a company.

The way it is analyzed is wrong, and even if it was right the code is also wrong.

I have described it well enough in ZF-9275 and also here, I don't see how opening another issue would get the problem fixed.

Another thing you could do would be to associate keywords to translations so things wouldn't be so confusing to other maintainers.

Show
Dominique Lorre added a comment - You are the maintainer of Zend_Translate then do me a favor: explain to other maintainers that there is no such things as 'priority' in translations. When a sentence is translated right I want to reuse it not see another translation override something that works. You are giving free time I'm grateful because that bug is over 3 monthes old and still not fixed, yet it is classified as RESOLVED. People would be fired for that in a company. The way it is analyzed is wrong, and even if it was right the code is also wrong. I have described it well enough in ZF-9275 and also here, I don't see how opening another issue would get the problem fixed. Another thing you could do would be to associate keywords to translations so things wouldn't be so confusing to other maintainers.
Hide
Dominique Lorre added a comment -

Which means that people like me are giving their sparetime for others like you. I am not paid for this service nor for my sparetime.

I'm not paid either to report bugs to developers like you. I spent many hours commenting on this issue, waited 3 monthes to see it fixed, I even listed the exact source code which is defective, you and other maintainers just have to look and fix the issue.

It sure would have been less a trouble to me to not report this issue and use a workaround. When you close an issue because it is referred as'Zend_Translate' instead of 'Zend_Form', it is disheartening to those who took time to report it and not helping to improve anything at all.

The issue is still here and I am not going to comment on it anymore.

Show
Dominique Lorre added a comment -
Which means that people like me are giving their sparetime for others like you. I am not paid for this service nor for my sparetime.
I'm not paid either to report bugs to developers like you. I spent many hours commenting on this issue, waited 3 monthes to see it fixed, I even listed the exact source code which is defective, you and other maintainers just have to look and fix the issue. It sure would have been less a trouble to me to not report this issue and use a workaround. When you close an issue because it is referred as'Zend_Translate' instead of 'Zend_Form', it is disheartening to those who took time to report it and not helping to improve anything at all. The issue is still here and I am not going to comment on it anymore.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: