-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Drop more usages of Serializable #30286
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
Conversation
Typo: |
ec32e2d
to
6162229
Compare
Drupal extends |
@alexpott thanks, then the plan for Drupal should be to stop calling |
37674f1
to
66b50bf
Compare
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 remove the possibility to serialize a Kernel as I don't see (anymore) the use cases.
966d44a
to
856ae9f
Compare
Actually, that's not possible: the kernel is serialized in FrameworkBundle for insulated tests, see
|
856ae9f
to
05d6475
Compare
Thank you @nicolas-grekas. |
This PR was merged into the 4.3-dev branch. Discussion ---------- Drop more usages of Serializable | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - When the serialized payload of some class is used for ephemeral needs, my proposal here is to drop implementing `Serializable` and provide a deprecation layer based on `__sleep` to still call the `serialize`/`unserialize` methods. This means that at the behavior level, we provide BC, and at the payload level, we don't. That leaves us with only two "not ephemeral" use cases: - `Route` and `CompilerRoute` instances are serialized by Drupal. We'd better not break such existing payloads without being sure it's ok for Drupal (ping @alexpott). My proposal in this PR is to schedule the BC break for Symfony 5, and ask Drupal (and others) to add a check in their unserialization logic so that they are able to recompile the cached list of routes if unserialize fails due to this change. They could alternatively implement `Serializable` on their own, without calling `parent::(un)serialize()`. - `TokenInterface` from `Security` - for this one, I have no idea yet, except either plan for breaking BC at the payload level (which would mean invalidating all sessions when moving to SF5) - or create a new interface if we think breaking sessions is not reasonable. For now, I've kept using `Serializable`, which could be also fine keeping if we mark the corresponding method `final` to force WDYT? Commits ------- 05d6475 Drop more usages of Serializable
…(Tobion) This PR was merged into the 4.3 branch. Discussion ---------- [Routing] revert deprecation of Serializable in routing | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | we still need to implement Serializable as long as we support PHP < 7.4. otherwise serialized data in php 7.2 would not work anymore when people upgrade to php 7.4. see discussion in #31792 (comment) partly reverts #30286 Commits ------- d32a295 [Routing] revert deprecation of Serializable in routing
This PR was merged into the 5.0-dev branch. Discussion ---------- [Routing] remove deprecations | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | yes <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Ref. #30249, #30286, #24894 Commits ------- 5beb5f8 [Routing] remove deprecations
When the serialized payload of some class is used for ephemeral needs, my proposal here is to drop implementing
Serializable
and provide a deprecation layer based on__sleep
to still call theserialize
/unserialize
methods. This means that at the behavior level, we provide BC, and at the payload level, we don't.That leaves us with only two "not ephemeral" use cases:
Route
andCompilerRoute
instances are serialized by Drupal. We'd better not break such existing payloads without being sure it's ok for Drupal (ping @alexpott). My proposal in this PR is to schedule the BC break for Symfony 5, and ask Drupal (and others) to add a check in their unserialization logic so that they are able to recompile the cached list of routes if unserialize fails due to this change. They could alternatively implementSerializable
on their own, without callingparent::(un)serialize()
.TokenInterface
fromSecurity
- for this one, I have no idea yet, except either plan for breaking BC at the payload level (which would mean invalidating all sessions when moving to SF5) - or create a new interface if we think breaking sessions is not reasonable. For now, I've kept usingSerializable
, which could be also fine keeping if we mark the corresponding methodfinal
to forceWDYT?