-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Regression in validator #50780
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
Comments
Same with the upgrade of symfony/validator @nicolas-grekas looks like it's related with yours changes: symfony/validator@81772c1 |
Could anyone come up with a test case to prevent a regression? |
@garak do you have a reproducer? I can try to extract from my project, but it will take some time |
Meanwhile I can confirm the same problem with validator 6.3.1 (while 6.3.0 works). In the XML validation, I have: <?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"
>
<class name="Application\Command\User\AbstractCommand">
<property name="password">
<constraint name="Length">
<option name="min">8</option>
<option name="max">255</option>
</constraint>
</property>
</class
<class name="Application\Command\User\CreateCommand">
<property name="password">
<constraint name="NotBlank"/>
</property>
</class>
</constraint-mapping> So, when I validate |
….1 (TheMilek) This PR was merged into the 1.12 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 <!-- see the comment below --> | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Related tickets | symfony/symfony#50780 | | License | MIT | <!-- - Bug fixes must be submitted against the 1.12 branch - Features and deprecations must be submitted against the 1.13 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> It's probably related to [this](symfony/validator@81772c1) change Commits ------- Add conflict to symfony/validator 5.4.25, 6.2.12 and 6.3.1 versions Update conflicts file
We have noticed the same behaviour in our project. We use the FOSUserBundle and have extended the user entity. |
… classes (rmikalkenas) This PR was merged into the 5.4 branch. Discussion ---------- [Validator] Fix regression with class metadatada on parent classes | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | 5EBD Tickets | Fix #50780 | License | MIT Commits ------- e98f5f2 [Validator] Fix regression with class metadatada on parent classes
Symfony version(s) affected
5.4.25, 6.2.12, 6.3.1
Description
Upgrading symfony/validator from 5.4.34 to 5.4.35 breaks validation in a project of mine.
Some properties that have a NotBlank constraint applied are not detected as invalid when submitted without a value.
It seems that the regression was introduced in this change 6a3a4d7#diff-50c23a0a9ba92c8fb19fa501720ad061da508e3ccfd98fbcdfff2b7c8c6e6499 but unfortunately I cannot understand how.
How to reproduce
I'm sorry but it seems not so easy to provide a reproducer. In my project, I use XML validation and the problem appears on a property which is not directly defined in the validated object (it's defined in a parent object)
Possible Solution
Sorry, no clue about this
Additional Context
I isolated the problem during an upgrade, by requiring in my composer.json
"symfony/validator": "^5.4,<5.4.25"
. With this requirement, all my tests pass.If I replace it with the simple
"symfony/validator": "^5.4"
, the tests breakThe text was updated successfully, but these errors were encountered: