Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] Ensure a group is set on a constraint (fix BC break)#44847
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lyrixx commentedDec 29, 2021
| Q | A |
|---|---|
| Branch? | 4.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#44846 |
| License | MIT |
| Doc PR |
nicolas-grekas commentedDec 29, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Are you calling the constructor? Because if not, that's the issue. The property is supposed to be lazily initialized (that's why it's unset in the constructor) |
lyrixx commentedDec 29, 2021
No I don't. It used to work in previous version of symfony. And nothing force us to call the constructor (like it can be done in Command class). So to me it's a BC break and this PR solves this issue |
nicolas-grekas commentedDec 29, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This change is going to break Composite constraints, see symfony/src/Symfony/Component/Validator/Constraints/Composite.php Lines 82 to 96 in4274a1f
I understand this worked before because the property was undeclared. But to adapt to PHP 8.2, we have to declare all properties. Any other idea? |
nicolas-grekas commentedDec 29, 2021
Instead, can't we check that the property is null, meaning it need to be unset and __get again before being usable? |
stof commentedDec 29, 2021
Also, I suggest trigger a deprecation saying that the parent constructor must be called. |
lyrixx commentedDec 29, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
how would you do that? with a check in all public method? |
nicolas-grekas commentedDec 30, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
What about#44854 instead? |
…en called (nicolas-grekas)This PR was merged into the 4.4 branch.Discussion----------[Validator] throw when Constraint::_construct() has not been called| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#44846| License | MIT| Doc PR | -Instead of#44847Commits-------20aacce [Validator] throw when Constraint::_construct() has not been called
ogizanagi commentedDec 31, 2021
Superseded by#44854 |