-
-
Notifications
You must be signed in to change notification settings - Fork 452
Replace Zend_Validate with symfony/validator
#4612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
sad Also, you might need to look at this: |
I tried, but writing rules is more intuitive with that ... imho.
I am aware of it, but latest version requies php 8.1. |
|
for the current changes in this MR, Symfony Validator might be easy too. the bigger use would be that we could validate entire objects like Customer Address at once Also the Intl/Translation support is nice, so we could have the errors already translated by the System |
|
I would be in favor of switching this to Symfony validation. Looking at this from a bigger picture, it would be best if we picked a library of components (e.g. Symfony/Laminas/etc.) and stuck to those throughout the project when replacing outdated libraries. IMO not doing this will increase the maintenance burden long term with differing packages/conventions to keep track of. |
# Conflicts: # composer.json # composer.lock
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
# Conflicts: # app/code/core/Mage/Review/Model/Review.php # app/code/core/Mage/Wishlist/controllers/IndexController.php # tests/unit/Mage/Newsletter/Model/TemplateTest.php
| if (Mage::helper('core/string')->strlen($password) < $minAdminPasswordLength) { | ||
| $errors->append(Mage::helper('adminhtml') | ||
| ->__('Password must be at least of %d characters.', $minAdminPasswordLength)); | ||
| $violations = new ArrayObject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would like it if the part with the validatePassword would be put into an extra Function, easier to rewrite
(like adding extra validation rules via Modules)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| message: Mage::helper('customer')->__('Invalid email address "%s".', $email), | ||
| )); | ||
|
|
||
| $password = $this->getPassword(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same there, I would like it to have the Password Validation in an extra Function
Maybe to not duplicate code with validateResetPassword?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice catch!
validatePassword was not finished yet to make it re-usable.
Updated validatePassword and added extra methods as suggested.
# Conflicts: # app/code/core/Mage/Admin/Model/Block.php # app/code/core/Mage/Admin/Model/Resource/User.php # app/code/core/Mage/Admin/Model/User.php # app/code/core/Mage/Admin/Model/Variable.php # app/code/core/Mage/Api/Model/User.php # app/code/core/Mage/Api2/Model/Resource/Validator/Fields.php # app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php # app/code/core/Mage/Core/Model/App.php # app/code/core/Mage/Core/Model/Variable.php # app/code/core/Mage/Customer/Model/Customer.php # app/code/core/Mage/Eav/Model/Attribute/Data/Abstract.php # app/code/core/Mage/Eav/Model/Entity/Attribute.php # app/code/core/Mage/Eav/Model/Entity/Setup.php # app/code/core/Mage/Newsletter/Model/Template.php # app/code/core/Mage/Oauth/Model/Consumer/Validator/KeyLength.php # app/code/core/Mage/Review/Model/Review.php # app/code/core/Mage/Widget/Model/Widget/Instance.php # composer.lock
|
|
Working on some test, but thats hopefully ready for review. |





Description (*)
Added new helper
Mage_Core_Helper_Validatethat contains some wrapper methods for symfony validation.Moved some parts of
Zend_Validate_AbstracttoMage_Core_Helper_Validation_Abstractfor some backwacrd compa. (may be removed later).Related Pull Requests
Additinal notes
Password validation for customer accounts has been improved. It is not possibly anymore to use weak passwords (e.g. 12345678). See 7891569