-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Breaking change caused by return types upgrade from 4.3 to 4.4 #34478
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
The |
Actually we might want to reconsider this one: __sleep is the only way to serialize an objet so there is no other choice than overriding it. It doesn't totally "belong to us". |
I believe this particular issue was fixed already though: sonata-project/SonataCoreBundle#716 |
That fix isn't released, and is on a bundle that is now deprecated. The Sonata bundles typically have quite a slow release cycle, so it'll almost certainly be faster to get this fixed in Symfony. |
@nicolas-grekas — what should we do? Make a bugfix release to Symfony? This issue is pretty important because prevents our projects from upgrading to 4.4 LTS. |
see #34513 for the fix |
…(xabbuh) This PR was merged into the 4.4 branch. Discussion ---------- [Validator] remove return type declaration from __sleep() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34478 | License | MIT | Doc PR | Commits ------- bedad35 remove return type declaration from __sleep()
Symfony version(s) affected: 4.4.0
Description
Upgrading from 4.3 to 4.4 today causing cache clearing and the bundle : sonata admin bundle to throw errors.
From the commit "Add return types to internal|final|private methods" 3211618
Return type was forced even on magic methods which can cause breaking changes on third party libraries overriding them without specifying the return type
How to reproduce
To reproduce the bug simply create a new Constraint class overriding one of the method where the return type was forced in 4.4, this class will work in 4.3 but not when upgrading in 4.4
class MyConstraint extends Constraint { public function __sleep(){ ...} }
Possible Solution
Maybe don't force return types on 4.4 version to keep retro compatibility
and do those breaking changes in 5 ?
The text was updated successfully, but these errors were encountered: